mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
ScheduleBase refactor
This commit is contained in:
+2
-2
@@ -1454,9 +1454,9 @@ App::setResource('deviceForBuilds', function ($project) {
|
||||
return getDevice(APP_STORAGE_BUILDS . '/app-' . $project->getId());
|
||||
}, ['project']);
|
||||
|
||||
function getDevice($root): Device
|
||||
function getDevice(string $root, string $connection = null): Device
|
||||
{
|
||||
$connection = System::getEnv('_APP_CONNECTIONS_STORAGE', '');
|
||||
$connection = empty($connection) ? System::getEnv('_APP_CONNECTIONS_STORAGE', '') : System::getEnv($connection, '');
|
||||
|
||||
if (!empty($connection)) {
|
||||
$acl = 'private';
|
||||
|
||||
@@ -27,7 +27,8 @@ abstract class ScheduleBase extends Action
|
||||
|
||||
abstract protected function enqueueResources(
|
||||
Group $pools,
|
||||
Database $dbForConsole
|
||||
Database $dbForConsole,
|
||||
callable $getProjectDB
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
@@ -130,7 +131,7 @@ abstract class ScheduleBase extends Action
|
||||
|
||||
Console::success("Starting timers at " . DateTime::now());
|
||||
|
||||
run(function () use ($dbForConsole, &$lastSyncUpdate, $getSchedule, $pools) {
|
||||
run(function () use ($dbForConsole, &$lastSyncUpdate, $getSchedule, $pools, $getProjectDB) {
|
||||
/**
|
||||
* The timer synchronize $schedules copy with database collection.
|
||||
*/
|
||||
@@ -190,10 +191,10 @@ abstract class ScheduleBase extends Action
|
||||
|
||||
Timer::tick(
|
||||
static::ENQUEUE_TIMER * 1000,
|
||||
fn () => $this->enqueueResources($pools, $dbForConsole)
|
||||
fn () => $this->enqueueResources($pools, $dbForConsole, $getProjectDB)
|
||||
);
|
||||
|
||||
$this->enqueueResources($pools, $dbForConsole);
|
||||
$this->enqueueResources($pools, $dbForConsole, $getProjectDB);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user