Code Monkey home page Code Monkey logo

Comments (6)

dhh avatar dhh commented on July 28, 2024

That's going to conflict with people who expect a hash of options to their own job, unfortunately. When the argument is first, it's unambiguous.

On May 30, 2014, at 1:15, José Duarte [email protected] wrote:

Hi there,

I believe, to get a more consistent Rails-like syntax, that enqueue should have an options hash opposed to enqueue_in and enqueue_at methods.

So these would be valid method calls:

MyJob.enqueue record, :at => Date.tomorrow.now
MyJob.enqueue record, :in => 1.week
Since the given method definition is valid Ruby:

def enqueue(*args, options={})

...

end
it seems to me that it's a most concise approach given Rails method definitions.

What do you think?


Reply to this email directly or view it on GitHub.

from activejob.

cristianbica avatar cristianbica commented on July 28, 2024

What would work is

MyJob.enque in: 5.hours, args:[1, 2, option: 3]
MyJob.enque at: 5.hours.from_now, args:[1, 2, option: 3]
MyJob.enque args:[1, 2, option: 3]

but I personally prefer the 3 methods enqueue/enqueue_in/enqueue_at as it's cleaner

from activejob.

seuros avatar seuros commented on July 28, 2024

👍 for staying with the current syntax only.

from activejob.

Alexander-Senko avatar Alexander-Senko commented on July 28, 2024

What about this?

MyJob.at(Date.tomorrow).enqueue record
MyJob.in(1.week).enqueue record

Or this (bad for default usage)?

MyJob.enqueue(record).now
MyJob.enqueue(record).at Date.tomorrow
MyJob.enqueue(record).in 1.week

from activejob.

dhh avatar dhh commented on July 28, 2024

I don’t think that’s an improvement on the there separate enqueue methods.

On May 30, 2014, at 5:31 PM, Alexander Senko [email protected] wrote:

What about this?

MyJob.at(Date.tomorrow).enqueue record
MyJob.in(1.week).enqueue record
Or this (bad for default usage)?

MyJob.enqueue(record).now
MyJob.enqueue(record).at Date.tomorrow
MyJob.enqueue(record).in 1.week

Reply to this email directly or view it on GitHub.

from activejob.

jduarte avatar jduarte commented on July 28, 2024

Given the job arguments issue I believe the current syntax is the most appropriate.

from activejob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.