Skip to content

Commit

Permalink
Delete status keys after completion
Browse files Browse the repository at this point in the history
  • Loading branch information
OutOfBrain committed Jul 20, 2015
1 parent 82ad9d8 commit 5100483
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Job/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ public function update($status)
'updated' => $this->attributes['updated']
));

// Expire the status for completed jobs after 24 hours
if (in_array($status, self::$complete)) {
// Expire or delete the status for completed jobs after given time
if ($status == self::STATUS_COMPLETE) {
$this->client->del($this->getHashKey());
} elseif (in_array($status, self::$complete)) {
$this->client->expire($this->getHashKey(), self::COMPLETE_TTL);
} else {
$this->client->expire($this->getHashKey(), self::INCOMPLETE_TTL);
Expand Down

3 comments on commit 5100483

@firegate666
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment seems misleading, looks like completed jobs gets deleted right away and not after some time?

@derschatta
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, jobs are deleted right away. But the status is stored separately and must be either deleted or expired depending if the job was completed or not.

@OutOfBrain
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted comment to make this a bit more clear. 6d738e7

Please sign in to comment.