Originally created by @sun1752709589 on GitHub (Jan 22, 2017).
Rails 5.0.1
ruby 2.3.3
here is my code:
namespace :crono do
desc "hello"
task :hello => :environment do
puts 'hello...'
end
end
in cronotab.rb:
require 'rake'
Rails.app_class.load_tasks
class Test
def perform
Rake::Task['crono:hello'].invoke
end
end
Crono.perform(Test).every 5.seconds
Originally created by @sun1752709589 on GitHub (Jan 22, 2017).
Rails 5.0.1
ruby 2.3.3
```
here is my code:
namespace :crono do
desc "hello"
task :hello => :environment do
puts 'hello...'
end
end
in cronotab.rb:
require 'rake'
Rails.app_class.load_tasks
class Test
def perform
Rake::Task['crono:hello'].invoke
end
end
Crono.perform(Test).every 5.seconds
```
@bethadele commented on GitHub (Feb 15, 2017):
Once the rake task is invoked in this context, Rails will prevent it from running again unless you specifically re-enable it.
```
class Test
def perform
Rake::Task['crono:hello'].reenable
Rake::Task['crono:hello'].invoke
end
end
```
See [this blog post](https://til.hashrocket.com/posts/4897ed42b7-invoking-rake-tasks-multiple-times) for a little more detail.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @sun1752709589 on GitHub (Jan 22, 2017).
Rails 5.0.1
ruby 2.3.3
@bethadele commented on GitHub (Feb 15, 2017):
Once the rake task is invoked in this context, Rails will prevent it from running again unless you specifically re-enable it.
See this blog post for a little more detail.
@sun1752709589 commented on GitHub (Feb 16, 2017):
@bethadele Thank you