Run Rufus-Scheduler with Ruby on Rails

152 Views Asked by At

I'm trying to make a application that serves as an REST API, which is related to information regarding X.

Simultaneously, I'd like to schedule some task to be run from time to time so that it retrieves remote information and inserts it into the database.

Looking as a very atractive solution for a begginer like me, I decided to Rufus as in https://github.com/jmettraux/rufus-scheduler#so-rails.

Firstly, I started by doing some dummy code, to test it out, and it appeard to work as intented. First Try

The problem was after this, I tried doing so, but adding some real logic to it - "some task to be run from time to time so that it retrives remote information and inserts it into the database."

Here is when the issue begins: after the (usually) very first execution, the app doesn't do anything else - it even stops answering to REST requests. Then, as soon as I press Ctrl-C, it immediatly makes up for what it hasn't done, as in: does the "pending" tasks, printing the first logger.info as if it was in the intented time - although the insertion in the database only happens after I do this action of pressing Ctrl-C -, and answers to the REST requests.

After searching through the internet, I haven't found anything close to my problem, I believe I have some misconfiguration, or maybe I'm not running things as intented.

EDIT: Turns out I'm stupid and was pausing the program's execution, by selecting the terminal's text, as it was my first time developing on Windows.

0

There are 0 best solutions below