
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
This gem aims to create a simple yet efficient framework to handle job scheduling and execution. It is targeted for MongoDB database.
Add this line to your application's Gemfile:
gem 'mongodb-scheduler'
And then execute:
$ bundle install
This gem adds a Scheduler
module which can be started, stopped or restarted with their corresponding command:
$ scheduler start
$ scheduler stop
$ scheduler restart
A Scheduler
is a process that keeps running looking for jobs to perform. The jobs are documents of a specific collection that you can specify in the scheduler configuration file. You can specify your own model to act as a schedulable entity, as long as it includes the Schedulable
module. The other configuration options are explained in the template file lib/scheduler/templates/scheduler.rb
file.
As an example, the gem comes with a Scheduler::Examples::SchedulableModel
which is a bare class that just includes the Scheduler::Schedulable
module, and also an Scheduler::Examples::ExecutableClass
class which is a bare implementation of an executable class.
An executable class is just a plain Ruby class which must implement a call
method which accepts the same arguments that you passed to the schedulable model attribute args
.
Also, the executable class, must have the first argument of its initialize
method to accept the current instance of the schedulable model.
First start by running the scheduler:
$ scheduler start
You can then queue jobs by calling:
YourSchedulableModel.schedule('YourExecutableClass', args...) # to queue
Both methods create a document of YourSchedulableModel
and put it in queue.
The perform_now method skips the scheduler and performs the job immediately, instead the perform_later leaves the performing task to the scheduler.
If you want to stop the scheduler, just run:
$ scheduler stop
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that mongodb-scheduler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.