{"id":33193226,"url":"https://github.com/soveran/ost","last_synced_at":"2025-12-30T00:29:58.787Z","repository":{"id":869330,"uuid":"608680","full_name":"soveran/ost","owner":"soveran","description":"Redis based queues and workers.","archived":false,"fork":false,"pushed_at":"2017-06-22T19:46:14.000Z","size":39,"stargazers_count":167,"open_issues_count":2,"forks_count":14,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-08T04:41:35.607Z","etag":null,"topics":["lesscode","queueing","ruby","workers"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soveran.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-04-13T16:59:07.000Z","updated_at":"2024-09-21T20:25:54.000Z","dependencies_parsed_at":"2022-07-26T05:46:10.317Z","dependency_job_id":null,"html_url":"https://github.com/soveran/ost","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/soveran/ost","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soveran%2Fost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soveran%2Fost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soveran%2Fost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soveran%2Fost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soveran","download_url":"https://codeload.github.com/soveran/ost/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soveran%2Fost/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285538230,"owners_count":27188646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lesscode","queueing","ruby","workers"],"created_at":"2025-11-16T07:00:30.423Z","updated_at":"2025-11-21T01:00:41.754Z","avatar_url":"https://github.com/soveran.png","language":"Ruby","readme":"Ost\n===\n\nRedis based queues and workers.\n\n![Ost Cafe, by Arancia Project](http://farm4.static.flickr.com/3255/3161710005_36566b8a9e.jpg)\n\nDescription\n-----------\n\n**Ost** makes it easy to enqueue object ids and process them with\nworkers.\n\nSay you want to process video uploads. In your application you will\nhave something like this:\n\n``` ruby\nOst[:videos_to_process].push(@video.id)\n```\n\nThen, you will have a worker that will look like this:\n\n``` ruby\nrequire \"ost\"\n\nOst[:videos_to_process].each do |id|\n  # Do something with it!\nend\n```\n\nUsage\n-----\n\nOst uses a lightweight Redis client called [Redic][redic]. To connect to\na Redis database, you will need to set an instance of `Redic`, with a URL\nof the form `redis://:\u003cpasswd\u003e@\u003chost\u003e:\u003cport\u003e/\u003cdb\u003e`.\n\nYou can customize the connection by calling `Ost.redis=`:\n\n``` ruby\nrequire \"ost\"\n\nOst.redis = Redic.new(\"redis://127.0.0.1:6379\")\n```\n\nThen you only need to refer to a queue for it to pop into existence:\n\n``` ruby\nrequire \"ost\"\n\nOst.redis = Redic.new(\"redis://127.0.0.1:6379\")\n\nOst[:rss_feeds] \u003c\u003c @feed.id\n```\n\nOst defaults to a Redic connection to `redis://127.0.0.1:6379`. The example\nabove could be rewritten as:\n\n``` ruby\nrequire \"ost\"\n\nOst[:rss_feeds] \u003c\u003c @feed.id\n```\n\nA worker is a Ruby file with this basic code:\n\n``` ruby\nrequire \"ost\"\n\nOst[:rss_feeds].each do |id|\n  # ...\nend\n```\n\nIt will pop items from the queue as soon as they become available. It\nuses `BRPOPLPUSH` with a timeout that can be specified with the\n`OST_TIMEOUT` environment variable.\n\nNote that in these examples we are pushing numbers to the queue. As\nwe have unlimited queues, each queue should be specialized and the\nworkers must be smart enough to know what to do with the numbers they\npop.\n\nAvailable methods\n=================\n\n`Ost[:example].push item`, `Ost[:some_queue] \u003c\u003c item`: add `item` to\nthe `:example` queue.\n\n`Ost[:example].pop { |item| ... }`, `Ost[:example].each { |item| ...\n}`: consume `item` from the `:example` queue. If the block doesn't\ncomplete successfully, the item will be left at a backup queue.\n\n`Ost.stop`: halt processing for all queues.\n\n`Ost[:example].stop`: halt processing for the `example` queue.\n\nFailures\n========\n\n**Ost** stores in-process items in backup queues. That allows the\ndeveloper to deal with exceptions in a way that results adequate\nfor his application.\n\nThere is one backup queue for each worker, with the following\nconvention for naming the key in Redis: given a worker using the\n`:events` queue, running in the hostname `domU-12-31-39-04-49-C7`\nwith the process id `28431`, the key for the backup queue will be\n`ost:events:domU-12-31-39-04-49-C7:28431`.\n\nHere's the explanation for each part:\n\n* `ost`: namespace for all **Ost** related keys.\n* `events`: name of the queue.\n* `domU-12-31-39-04-49-C7`: hostname of the worker.\n* `28431`: process id of the worker.\n\nPriorities\n----------\n\nThere's no concept of priorities, as each queue is specialized and you\ncan create as many as you want. For example, nothing prevents the\ncreation of the `:example_high_priority` or the\n`:example_low_priority` queues.\n\nDifferences with Delayed::Job and Resque\n----------------------------------------\n\nBoth [Delayed::Job](http://github.com/tobi/delayed_job) and\n[Resque](http://github.com/defunkt/resque) provide queues and workers\n(the latter using Redis). They provide dumb workers that process jobs,\nwhich are specialized for each task. The specialization takes place\nin the application side, and the job is serialized and pushed into a\nqueue.\n\n**Ost**, by contrast, just pushes numbers into specialized queues, and\nuses workers that are subscribed to specific queues and know what to\ndo with the items they get. The total sum of logic is about the same,\nbut there's less communication and less data transfer with **Ost**.\n\nInstallation\n------------\n\n    $ gem install ost\n\n[redic]: https://github.com/amakawa/redic\n","funding_links":[],"categories":["Redis based Job Queues"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoveran%2Fost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoveran%2Fost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoveran%2Fost/lists"}