https://github.com/cjhdev/timeout_queue
Like Ruby Queue but supports pop timeout
https://github.com/cjhdev/timeout_queue
queue ruby timeout
Last synced: about 1 year ago
JSON representation
Like Ruby Queue but supports pop timeout
- Host: GitHub
- URL: https://github.com/cjhdev/timeout_queue
- Owner: cjhdev
- License: mit
- Created: 2019-08-07T13:53:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-11T11:14:55.000Z (about 2 years ago)
- Last Synced: 2025-02-22T10:51:15.765Z (about 1 year ago)
- Topics: queue, ruby, timeout
- Language: Ruby
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
timeout_queue
=============
It's like Queue except:
- #pop has an optional timeout
- #unshift will put an object on the front of the queue
- #delete can remove an object from the queue
## Usage
Install as a Gem using your preferred method.
Require:
~~~
require 'timeout_queue'
~~~
Use:
~~~
q = TimeoutQueue.new
begin
# wait for no more than one second
q.pop(timeout: 1)
rescue ThreadError
# you timed out
end
~~~
## License
timeout_queue has an MIT license.