Skip to content

Commit

Permalink
Merge pull request #258 from Shopify/cbruckmayer/fix-static-queue-expiry
Browse files Browse the repository at this point in the history
Fix expiry of static queue
  • Loading branch information
ChrisBr authored Feb 6, 2024
2 parents c356cdb + 8335365 commit 5bc8813
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ruby/lib/ci/queue/static.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def created_at=(timestamp)
end

def expired?
(@created_at.to_f TEN_MINUTES) < CI::Queue.time_now.to_f
(@created_at.to_f + TEN_MINUTES) < CI::Queue.time_now.to_f
end

def populated?
Expand Down
8 changes: 8 additions & 0 deletions ruby/test/ci/queue/static_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
class CI::Queue::StaticTest < Minitest::Test
include SharedQueueAssertions

def test_expired
queue = CI::Queue.from_uri('list:foo:bar:plop%3Ffizz', config)
assert queue.expired?

queue.created_at = Time.now
refute queue.expired?
end

private

def build_queue
Expand Down

0 comments on commit 5bc8813

Please sign in to comment.