Skip to content

Commit

Permalink
Merge pull request #16 from gyselroth/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
raffis authored Jan 28, 2019
2 parents 0ff5436 + 2fe7acb commit 3a13e39
Show file tree
Hide file tree
Showing 26 changed files with 44 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $header = <<<'EOF'
TaskScheduler
@author Raffael Sahli <[email protected]>
@copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
@copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
@license MIT https://opensource.org/licenses/MIT
EOF;

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 3.0.2
**Maintainer**: Raffael Sahli <[email protected]>\
**Date**: Mon Jan 28 12:18:34 CET 2018

* [CHANGE] Set intial datetime (not 0), writer worker caught exception: 10003 Cannot change the size of a document in a capped collection #15


## 3.0.1
**Maintainer**: Raffael Sahli <[email protected]>\
**Date**: Thu Jan 25 17:29:34 CET 2018
Expand Down
2 changes: 1 addition & 1 deletion src/AbstractJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InternalQueueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidJobException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/JobNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/SpawnForkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/InjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
3 changes: 1 addition & 2 deletions src/JobInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down Expand Up @@ -36,7 +36,6 @@ interface JobInterface
self::STATUS_TIMEOUT => 'timeout',
];


/**
* Get job data.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/MessageQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
6 changes: 3 additions & 3 deletions src/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down Expand Up @@ -64,7 +64,7 @@ class Queue
protected $manager_pid;

/**
* Sysmfsg queue
* Sysmfsg queue.
*
* @var resource
*/
Expand Down Expand Up @@ -198,7 +198,7 @@ protected function main(): void
$this->main();
});

if($event !== null) {
if (null !== $event) {
$this->handleEvent($event);
}

Expand Down
9 changes: 5 additions & 4 deletions src/Scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down Expand Up @@ -258,12 +258,13 @@ public function cancelJob(ObjectId $id): bool
}

/**
* Flush
* Flush.
*/
public function flush(): Scheduler
{
$this->db->{$this->job_queue}->drop();
$this->db->{$this->event_queue}->drop();

return $this;
}

Expand Down Expand Up @@ -448,8 +449,8 @@ protected function prepareInsert(string $class, $data, array &$options = []): ar
'class' => $class,
'status' => JobInterface::STATUS_WAITING,
'created' => new UTCDateTime(),
'started' => new UTCDateTime(0),
'ended' => new UTCDateTime(0),
'started' => new UTCDateTime(),
'ended' => new UTCDateTime(),
'worker' => new ObjectId(),
'data' => $data,
];
Expand Down
2 changes: 1 addition & 1 deletion src/SchedulerValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion src/WorkerFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
4 changes: 2 additions & 2 deletions src/WorkerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down Expand Up @@ -113,7 +113,7 @@ class WorkerManager
protected $onhold = [];

/**
* Worker factory
* Worker factory.
*
* @var WorkerFactoryInterface
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/JobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/MessageQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/Mock/ErrorJobMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/Mock/SuccessJobMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/QueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
10 changes: 6 additions & 4 deletions tests/SchedulerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand All @@ -21,6 +21,7 @@
use TaskScheduler\JobInterface;
use TaskScheduler\Process;
use TaskScheduler\Scheduler;
use MongoDB\BSON\UTCDateTime;

class SchedulerTest extends TestCase
{
Expand Down Expand Up @@ -89,10 +90,11 @@ public function testFlush()

public function testNewJobTimestamps()
{
$ts = new UTCDateTime();
$job = $this->scheduler->addJob('test', ['foo' => 'bar'])->toArray();
$this->assertTrue((string) $job['created'] > '0');
$this->assertSame((string) $job['started'], '0');
$this->assertSame((string) $job['ended'], '0');
$this->assertTrue($job['created'] >= $ts);
$this->assertTrue($job['started'] >= $ts);
$this->assertTrue($job['ended'] >= $ts);
}

public function testGetJob()
Expand Down
2 changes: 1 addition & 1 deletion tests/WorkerManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/WorkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* TaskScheduler
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2017-2018 gyselroth GmbH (https://gyselroth.com)
* @copyright Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
* @license MIT https://opensource.org/licenses/MIT
*/

Expand Down

0 comments on commit 3a13e39

Please sign in to comment.