Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending Helper Class #81

Open
JWhiteSS opened this issue Jul 3, 2017 · 1 comment
Open

Extending Helper Class #81

JWhiteSS opened this issue Jul 3, 2017 · 1 comment

Comments

@JWhiteSS
Copy link

JWhiteSS commented Jul 3, 2017

It would be nice to have the ability to easily extend the helper class.

In my case, I cannot write to the file system. Instead, I would extend Helper's acquireLock(), releaseLock(), & getLockLifetime() functions to make them read / write to a table.

BackgroundJob accepts a third parameter for the helper class, but run-job does not pass anything for that parameter.

My alternative is to extend Jobby to make the property 'script' a different script that would do the same thing as run-job, but pass BackgroundJob a new Helper class. Is this the route you would recommend?

@hellogerard
Copy link
Member

@creativebum2 That sounds right to me. You would need to wrap all locking queries in a transaction to ensure you don't get multiple jobs accessing the same lock at once. You could also make it an abstraction to support different databases e.g. mysql, pgsql, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants