1
0
Fork 0
mirror of synced 2024-07-08 07:55:48 +12:00

cache deletion bug fix

This commit is contained in:
shimon 2023-06-13 17:03:33 +03:00
parent a4e055e21b
commit 9d75e65ba9

View file

@ -169,7 +169,7 @@ class DeletesV1 extends Worker
protected function deleteCacheByResource(Document $project, string $resource): void protected function deleteCacheByResource(Document $project, string $resource): void
{ {
$projectId = $project->getId(); $projectId = $project->getId();
$dbForProject = $this->getProjectDB($projectId); $dbForProject = $this->getProjectDB($project);
$document = $dbForProject->findOne('cache', [Query::equal('resource', [$resource])]); $document = $dbForProject->findOne('cache', [Query::equal('resource', [$resource])]);
if ($document) { if ($document) {
@ -199,11 +199,11 @@ class DeletesV1 extends Worker
*/ */
protected function deleteCacheByDate(string $datetime): void protected function deleteCacheByDate(string $datetime): void
{ {
$this->deleteForProjectIds(function (Document $projectId) use ($datetime) { $this->deleteForProjectIds(function (Document $project) use ($datetime) {
$dbForProject = $this->getProjectDB($projectId); $dbForProject = $this->getProjectDB($project);
$cache = new Cache( $cache = new Cache(
new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId) new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId())
); );
$query = [ $query = [
@ -214,8 +214,8 @@ class DeletesV1 extends Worker
'cache', 'cache',
$query, $query,
$dbForProject, $dbForProject,
function (Document $document) use ($cache, $projectId) { function (Document $document) use ($cache, $project) {
$path = APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $projectId . DIRECTORY_SEPARATOR . $document->getId(); $path = APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId() . DIRECTORY_SEPARATOR . $document->getId();
if ($cache->purge($document->getId())) { if ($cache->purge($document->getId())) {
Console::success('Deleting cache file: ' . $path); Console::success('Deleting cache file: ' . $path);