Skip to content

Commit 2085c16

Browse files
committed
patch: added logs for maintenance task
1 parent 4049f64 commit 2085c16

6 files changed

Lines changed: 87 additions & 80 deletions

File tree

‎.env‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ _APP_SMTP_PASSWORD=
2727
_APP_STORAGE_LIMIT=10000000
2828
_APP_FUNCTIONS_TIMEOUT=900
2929
_APP_FUNCTIONS_CONTAINERS=10
30+
_APP_MAINTENANCE_INTERVAL=60

‎Dockerfile‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ ENV _APP_SERVER=swoole \
9494
_APP_FUNCTIONS_CONTAINERS=10 \
9595
_APP_SETUP=self-hosted \
9696
_APP_VERSION=$VERSION \
97-
# The interval at which to carry out maintenance tasks
98-
# 1 day = 86400 seconds
99-
_APP_MAINTENANCE_INTERVAL=86400
97+
_APP_MAINTENANCE_INTERVAL=60
10098
#ENV _APP_SMTP_SECURE ''
10199
#ENV _APP_SMTP_USERNAME ''
102100
#ENV _APP_SMTP_PASSWORD ''

‎app/tasks/maintenance.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ function notifyDeleteAuditLogs(array $projectIds, int $interval)
8484
return $project->getId();
8585
}, $projects);
8686

87-
Console::info("[ MAINTENANCE ] Notifying deletes workers every {$interval} seconds");
88-
89-
notifyDeleteExecutionLogs($projectIds);
87+
Console::info("[ MAINTENANCE TASK ] Notifying deletes workers every {$interval} seconds");
88+
89+
// notifyDeleteExecutionLogs($projectIds);
9090
notifyDeleteAbuseLogs($projectIds, $interval);
91-
notifyDeleteAuditLogs($projectIds, $interval);
91+
// notifyDeleteAuditLogs($projectIds, $interval);
9292

9393
}, $intervalMicroseconds);
9494

‎app/workers/deletes.php‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ protected function deleteAbuseLogs($document)
146146
throw new Exception('Failed to delete abuse logs. No timestamp provided');
147147
}
148148

149+
$timeLimit = new TimeLimit("", 0, 1, function () use ($register) {
150+
return $register->get('db');
151+
});
152+
149153
foreach ($projectIds as $projectId) {
150-
$timeLimit = new TimeLimit("", 0, 0, function () use ($register) {
151-
return $register->get('db');
152-
});
154+
Console::success("Deleting abuse logs for Project: ", $projectId);
153155
$timeLimit->setNamespace('app_'.$projectId);
154156
$abuse = new Abuse($timeLimit);
155157

0 commit comments

Comments
 (0)