Code Monkey home page Code Monkey logo

Comments (6)

kaplanelad avatar kaplanelad commented on May 27, 2024

Hey @exzachlyvv
We are not supporting Cron or the scheduler. you can trigger the a task with your preferred operation

from loco.

jondot avatar jondot commented on May 27, 2024

@exzachlyvv with rails, historically, there were 3 ways to run scheduled jobs:

  1. always-on daemon, that keeps a schedule as well. usually there was special care for expressing a schedule in plain english.
schedule "every 2 weeks" do 
  # some code
end
  1. Creating a watchdog / task that "wakes up", checks if there are tasks to run, and runs all pending tasks per schedule. Usually this "watchdog" task was run every 5 minutes with Cron. This also means maintaining state ("what are the tasks that should run next?") persisted somewhere
  2. Having a queue with delayed job, where the delayed job worker is run periodically like (2) every constant time window.

Which technique would you be referring to?

from loco.

exzachlyvv avatar exzachlyvv commented on May 27, 2024

Any of these would work :)

My use case is simply that I need to run some code every X minutes. There are no requirements for a specific API.

Is this functionally Loco is interested in supporting (happy to help with it)? If yes, we can continue to discuss the ideal design for loco.

Simple idea: expose some endpoint /run-my-task and have an external service ping it every X minutes.

But ideally Loco can solve this problem :)

from loco.

ShallmentMo avatar ShallmentMo commented on May 27, 2024

Loco depends on sidekiq-rs which support Periodic Jobs. Maybe loco can expose the worker process in hooks(something like after_boot?) to support this?

from loco.

jondot avatar jondot commented on May 27, 2024

@ShallmentMo that's a great idea. I'm wondering how to integrate that seamlessly. On the face of it it looks like a "forever-running" await and so it needs a dedicated thread or process. So, if we create a Loco task and tell the user: "run this task in any way you like, it will hang and run the periodic jobs" it might work. On the other hand it will be 1 more extra process.
I'd welcome more ideas to satisfy: minimum user friction, and minimum resources neeed

from loco.

ShallmentMo avatar ShallmentMo commented on May 27, 2024

I don't know wether it might help or not. But I use sidekiq-cron to support cron job when using Rails and Sidekiq

from loco.

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.