{"id":15648019,"url":"https://github.com/markbates/dj_remixes","last_synced_at":"2025-04-30T13:52:27.306Z","repository":{"id":943767,"uuid":"720754","full_name":"markbates/dj_remixes","owner":"markbates","description":"Enhancements and improvements for Delayed Job 2.x","archived":false,"fork":false,"pushed_at":"2011-08-26T15:33:42.000Z","size":289,"stargazers_count":42,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T16:46:28.625Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.metabates.com","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/markbates.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-06-14T19:34:15.000Z","updated_at":"2022-10-31T18:15:44.000Z","dependencies_parsed_at":"2022-07-15T20:30:39.379Z","dependency_job_id":null,"html_url":"https://github.com/markbates/dj_remixes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fdj_remixes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fdj_remixes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fdj_remixes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbates%2Fdj_remixes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markbates","download_url":"https://codeload.github.com/markbates/dj_remixes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251714939,"owners_count":21631806,"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","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":[],"created_at":"2024-10-03T12:22:45.944Z","updated_at":"2025-04-30T13:52:27.286Z","avatar_url":"https://github.com/markbates.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"h1. DJ Remixes\n\nA boat load of incredibly useful 'plugins' for Delayed::Job! DJ is a wonderful project and is incredibly useful, however it can be even more useful with just a few extras added in.\n\nh2. The Extras\n\n* A proper 'Worker' class: DJ::Worker that accepts attributes.\n* Callbacks\n* Airbrake (Hoptoad) support, if using Airbrake.\n* Priority settings\n* Automatic re-enqueueing\n* Better scheduling\n* Unique jobs.\n* more ...\n\nThese are a few of the extras for DJ that are included here.\n\nh2. Installation\n\nIn your \u003ccode\u003eGemfile\u003c/code\u003e add the following:\n\n\u003cpre\u003e\u003ccode\u003e\n  gem \"delayed_job\", \"2.1.4\"\n  gem \"dj_remixes\"\n\u003c/code\u003e\u003c/pre\u003e\n\nThen install the gems:\n\n\u003cpre\u003e\u003ccode\u003e\n  $ bundle install\n\u003c/code\u003e\u003c/pre\u003e\n\nCreate a migration to add the required dj_remixes fields to the delayed_job table:\n\n\u003cpre\u003e\u003ccode\u003e\n  class AddDjRemixesColumns \u003c ActiveRecord::Migration\n    def self.up\n      add_column :delayed_jobs, :worker_class_name,   :string\n      add_column :delayed_jobs, :started_at,          :datetime\n      add_column :delayed_jobs, :finished_at,         :datetime\n    end\n\n    def self.down\n      remove_column :delayed_jobs, :worker_class_name\n      remove_column :delayed_jobs, :started_at\n      remove_column :delayed_jobs, :finished_at\n    end\n  end\n\u003c/code\u003e\u003c/pre\u003e\n\n\nh2. Using\n\nh3. Basic Worker\n\n\u003cpre\u003e\u003ccode\u003e\n  class FooWorker \u003c DJ::Worker\n  \n    def perform\n      # do work\n    end\n  \n  end\n  \n  FooWorker.enqueue\n\u003c/code\u003e\u003c/pre\u003e\n\nh3. Unique Worker\n\nTell DJ to only allow one of this worker at a given time.\n\n\u003cpre\u003e\u003ccode\u003e\n  # We only want to charge the card once!\n  class PurchaseWorker \u003c DJ::Worker\n    is_unique\n  \n    def perform\n      # charge the credit card...\n    end\n  end\n\u003c/code\u003e\u003c/pre\u003e\n\nIf the worker has an \u003ccode\u003eid\u003c/code\u003e attribute that then will be used in conjunction with the class name of the worker to form the unique key.\n\nh3. Priority\n\nTell DJ to run this worker with a higher priority than others.\n\n\u003cpre\u003e\u003ccode\u003e\n  class FooWorker \u003c DJ::Worker\n    priority :high\n  \n    def perform\n      # do work\n    end\n  \n  end\n  \n  FooWorker.enqueue\n\u003c/code\u003e\u003c/pre\u003e\n\nh3. Re-Enqueueing\n\nTell DJ to re-enqueue this worker after it has successfully completely. *NOTE*: This will actually create a new DJ object in the database, not reuse the same one.\n\n\u003cpre\u003e\u003ccode\u003e\n  # Run every 30 days and charge a credit card.\n  class SubscriptionWorker \u003c DJ::Worker\n    re_enqueue\n\n    def run_at\n      30.days.from_now\n    end\n\n    def perform\n      # charge the credit card...\n    end\n  end\n\u003c/code\u003e\u003c/pre\u003e\n\nh3. Attributes\n\nThe \u003ccode\u003eDJ::Worker\u003c/code\u003e class can accept attributes, similar to the way an \u003ccode\u003eActiveRecord\u003c/code\u003e model can.\n\n\u003cpre\u003e\u003ccode\u003e\n  class FooWorker \u003c DJ::Worker\n    priority :high\n  \n    def perform\n      # do work\n      puts self.id # =\u003e 1\n      puts self.person # =\u003e 'Mark Bates'\n    end\n  \n  end\n  \n  worker = FooWorker.new(:id =\u003e 1, :person =\u003e 'Mark Bates')\n  worker.enqueue!\n\u003c/code\u003e\u003c/pre\u003e\n\nh2. Contributors\n\n* Mark Bates\n* Stuart Garner\n* Brent Kirby\n* Luke Pearce\n* Lars Pindrake ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Fdj_remixes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkbates%2Fdj_remixes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbates%2Fdj_remixes/lists"}