Clean up scheduling
This commit is contained in:
parent
7d6f4449a6
commit
c60a936f99
1 changed files with 7 additions and 8 deletions
15
bots.rb
15
bots.rb
|
@ -32,19 +32,18 @@ class ERWEbooksBot < Ebooks::Bot
|
||||||
def top20; @top20 ||= model.keywords.take(20); end
|
def top20; @top20 ||= model.keywords.take(20); end
|
||||||
|
|
||||||
def on_startup
|
def on_startup
|
||||||
|
log "Starting up bot for @#{original} at #{Time.now}"
|
||||||
|
|
||||||
@model_path ||= "model/#{original}.model"
|
@model_path ||= "model/#{original}.model"
|
||||||
@archive_path = "model/#{original}.json"
|
@archive_path ||= "model/#{original}.json"
|
||||||
|
|
||||||
archive!
|
# Post a tweet every hour
|
||||||
load_model!
|
scheduler.every '2h' do
|
||||||
|
|
||||||
scheduler.cron '23 6-23 * * *' do
|
|
||||||
# Post a tweet 23 minutes after every fourth hour.
|
|
||||||
tweet(model.make_statement)
|
tweet(model.make_statement)
|
||||||
end
|
end
|
||||||
|
|
||||||
scheduler.cron '0 5 * * *' do
|
# Every day at 5am update the corpus
|
||||||
# Every day at 5am update the corpus
|
scheduler.every '24h', :first => :now do
|
||||||
archive!
|
archive!
|
||||||
load_model!
|
load_model!
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue