| @@ -28,12 +28,11 @@ | ||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $w = (new Worker($database->q)) |
| 31 | 31 | ->withMaxTotalRuntimeInSeconds(5) |
| 32 | - ->withSleepTimeBetweenJobsInMilliseconds(0) | |
| 33 | - ->withSleepTimeOnEmptyQueueInMilliseconds(0) | |
| 32 | + ->withSleepTimeBetweenJobsInMilliseconds(1) | |
| 33 | + ->withSleepTimeOnEmptyQueueInMilliseconds(1) | |
| 34 | 34 | ; |
| 35 | - | |
| 36 | 35 | $w->process(function(Job $job) use ($database) { |
| 37 | 36 | $reflect = new \ReflectionClass($job->payload['type']); |
| 38 | 37 | $instance = $reflect->newInstanceArgs($job->payload['args']); |
| 39 | 38 | $instance->setQueue($database->q); |
| @@ -38,12 +37,9 @@ | ||
| 38 | 37 | $instance = $reflect->newInstanceArgs($job->payload['args']); |
| 39 | 38 | $instance->setQueue($database->q); |
| 40 | 39 | $instance->setFileEntryRepository($database->fileEntryRepository); |
| 41 | 40 | $instance->setSnapshotRepository($database->snapshotRepository); |
| 42 | - | |
| 43 | - $database->q->db->beginTransaction(); | |
| 44 | 41 | $instance->work(); |
| 45 | - $database->q->db->commit(); | |
| 46 | 42 | }); |
| 47 | 43 | |
| 48 | 44 | wp_die(); // All ajax handlers should die when finished |
| 49 | 45 | } |