[PR #36] [MERGED] Add the possibility to schedule jobs with arguments #84

Closed
opened 2025-12-29 00:22:27 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/plashchynski/crono/pull/36
Author: @jannishuebl
Created: 1/14/2016
Status: Merged
Merged: 1/16/2016
Merged by: @plashchynski

Base: masterHead: jhuebl_add_data_to_scheduled_job_20160113


📝 Commits (3)

  • dd4f92b add data to Cron.perform which will be passed to ExampleJob.new(data).perform
  • 89f3b9a change to args which will be passed to Job#perform
  • 0422289 document how to schedule jobs with arguments

📊 Changes

7 files changed (+55 additions, -17 deletions)

View changed files

📝 README.md (+9 -2)
📝 lib/crono/job.rb (+5 -4)
📝 lib/crono/performer_proxy.rb (+5 -4)
📝 lib/generators/crono/install/templates/migrations/create_crono_jobs.rb (+1 -0)
📝 spec/job_spec.rb (+25 -3)
📝 spec/performer_proxy_spec.rb (+6 -0)
📝 spec/scheduler_spec.rb (+4 -4)

📄 Description

I implemented the possibility to schedule jobs with arguments which will be persisted using JSON.
The use without arguments is still possible, but users have to run a migration which adds a text column to crono_jobs table.

Arguments can be set as following:

Crono.perform(TestJob, 'some', 'args').every 1.day, at: {hour: 12, min: 15}

For a Job like:

class TestJob
  def perform(some, args)
  end
end

I hope this change is conform with your idea of the project, if there is some problem please let me know.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/plashchynski/crono/pull/36 **Author:** [@jannishuebl](https://github.com/jannishuebl) **Created:** 1/14/2016 **Status:** ✅ Merged **Merged:** 1/16/2016 **Merged by:** [@plashchynski](https://github.com/plashchynski) **Base:** `master` ← **Head:** `jhuebl_add_data_to_scheduled_job_20160113` --- ### 📝 Commits (3) - [`dd4f92b`](https://github.com/plashchynski/crono/commit/dd4f92b5696bd926ac2a956bdce04ea5aaddc643) add data to Cron.perform which will be passed to ExampleJob.new(data).perform - [`89f3b9a`](https://github.com/plashchynski/crono/commit/89f3b9a8a1096b68bc84e32bb933ef0ef4ec6bff) change to args which will be passed to Job#perform - [`0422289`](https://github.com/plashchynski/crono/commit/042228900fcb617008126aaf17ef472e2375d4ee) document how to schedule jobs with arguments ### 📊 Changes **7 files changed** (+55 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+9 -2) 📝 `lib/crono/job.rb` (+5 -4) 📝 `lib/crono/performer_proxy.rb` (+5 -4) 📝 `lib/generators/crono/install/templates/migrations/create_crono_jobs.rb` (+1 -0) 📝 `spec/job_spec.rb` (+25 -3) 📝 `spec/performer_proxy_spec.rb` (+6 -0) 📝 `spec/scheduler_spec.rb` (+4 -4) </details> ### 📄 Description I implemented the possibility to schedule jobs with arguments which will be persisted using JSON. The use without arguments is still possible, but users have to run a migration which adds a text column to crono_jobs table. Arguments can be set as following: ``` ruby Crono.perform(TestJob, 'some', 'args').every 1.day, at: {hour: 12, min: 15} ``` For a Job like: ``` ruby class TestJob def perform(some, args) end end ``` I hope this change is conform with your idea of the project, if there is some problem please let me know. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 00:22:27 +01:00
adam closed this issue 2025-12-29 00:22:27 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/crono#84