1
0
Fork 0
mirror of synced 2024-10-02 02:07:04 +13:00

ScheduleBase refactor

This commit is contained in:
fogelito 2024-05-23 17:42:03 +03:00
parent 87ee2770a8
commit 06a5e76c50
2 changed files with 7 additions and 6 deletions

View file

@ -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';

View file

@ -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);
});
}
}