1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

Outline database resque worker

This commit is contained in:
kodumbeats 2021-06-17 14:22:06 -04:00
parent 160330675a
commit 90b280a014
3 changed files with 50 additions and 0 deletions

37
app/workers/database.php Normal file
View file

@ -0,0 +1,37 @@
<?php
use Utopia\Database\Database;
use Utopia\Cache\Adapter\Redis as RedisCache;
use Appwrite\Database\Document;
use Appwrite\Database\Validator\Authorization;
use Appwrite\Resque\Worker;
use Utopia\Storage\Device\Local;
use Utopia\Abuse\Abuse;
use Utopia\Abuse\Adapters\TimeLimit;
use Utopia\CLI\Console;
use Utopia\Config\Config;
use Utopia\Audit\Audit;
use Utopia\Cache\Cache;
use Utopia\Database\Adapter\MariaDB;
require_once __DIR__.'/../init.php';
Console::title('Database V1 Worker');
Console::success(APP_NAME.' database worker v1 has started'."\n");
class DeletesV1 extends Worker
{
public $args = [];
public function init(): void
{
}
public function run(): void
{
}
public function shutdown(): void
{
}
}

10
bin/worker-database Normal file
View file

@ -0,0 +1,10 @@
#!/bin/sh
if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ]
then
REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}"
else
REDIS_BACKEND="redis://${_APP_REDIS_USER}:${_APP_REDIS_PASS}@${_APP_REDIS_HOST}:${_APP_REDIS_PORT}"
fi
QUEUE='v1-database' APP_INCLUDE='/usr/src/code/app/workers/database.php' php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php

View file

@ -7,6 +7,9 @@ use Resque;
class Event
{
const DATABASE_QUEUE_NAME= 'v1-database';
const DATABASE_CLASS_NAME = 'DatabaseV1';
const DELETE_QUEUE_NAME = 'v1-deletes';
const DELETE_CLASS_NAME = 'DeletesV1';