GithubHelp home page GithubHelp logo

Comments (5)

edwardotis avatar edwardotis commented on September 3, 2024

This would also provide access to Client#removeDelayedEnqueue() for when we need to cancel a scheduled job. In the current grails implemenation, I don't see a way to destroy or remove a scheduled job.

net.greghaines.jesque.client.Client#removeDelayedEnqueue
net.greghaines.jesque.client.Client#delayedEnqueue

from grails-jesque.

edwardotis avatar edwardotis commented on September 3, 2024

I just got around to testing it, and there was no problem using the underlying jesque client for delayedEnqueue and removeDelayedEnqueue.

My test job executed at the correct time.
I was also able to delete a delayed test job correctly.

Using:
compile "org.grails.plugins:jesque:1.2.1"
grails 3.1.16

Here's examples using the jesque client syntax:

        jesqueService.jesqueClient.delayedEnqueue("myqueue",
                new Job(MyJesqueJob.simpleName, [user.id, myOtherArg]), myScheduledDateTime.getMillis()
        )

      jesqueService.jesqueClient.removeDelayedEnqueue("myqueue",
            new Job(MyJesqueJob.simpleName, [user.id, myOtherArg])
        )

So, it appears that it would be straight forward to use the jesque client in the next release.

from grails-jesque.

edwardotis avatar edwardotis commented on September 3, 2024

Actually, it would also require the grails plugin to integrate the 2.1.1 jesque project implementation of WorkerImpl.pop(), which uses a lua script to ensure that only a single worker runs a delayed and/or scheduled task. Otherwise, user is exposed to a pre jesque 2.1.1 bug where multiple workers execute a single delayed or recurring task. (This can be a disaster if the task is not explicitly, defensively coded to protect against this case. I've had to implement custom locking logic to ensure this in my app.)
gresrun/jesque#91

In the meantime, the current grails plugin doesn't support removing delayed tasks, which can be a deal breaker for many apps, and is natively supported in jesque.

from grails-jesque.

edwardotis avatar edwardotis commented on September 3, 2024

fyi, I confirmed that v1.2.1 grails plugin version of recurring jobs does not suffer from the multiple workers concurrently executing the recurring job jesque bug, even in a distributed environment. (Very good!)
i.e. Only one worker thread on one server executes the job at each recurring interval.

from grails-jesque.

bp-FLN avatar bp-FLN commented on September 3, 2024

I just worked on this a bit. See #27

Actually the jesque delayed job feature works a bit differently:
A delayed queue can not be used as a regular queue and vice versa.
Workers have to be configured to also poll delayed queues.
The workers pop method can handle both regular and delayed queues.

I managed to keep the plugins old behaviour by transparently handling of the jesque delayed queues.
This means that using the same queue name for enqueue and enqueueAt will still work.

Input welcome!

from grails-jesque.

Related Issues (18)

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.