ruby - dashing rufus scheduler updating two different values -
i'm using dashing display information taken jira bug tracking system.
using plugin: https://gist.github.com/christiangalsterer/1b24f2b42aa39ba63a92
i have ruby script gets number of jira issues based on filter, each filter in list. gets pushed 3 number widgets each displaying different filter.
require 'jira' last_issues = hash.new(6) jira_filters.each |filter_data_id, filter| scheduler.every '5s', :first_in => 0 |job| last_number_issues = last_issues['filter_data_id'] client = jira::client.new(jira_options) current_number_issues = client.issue.jql("filter in (\"# {filter[:filter]}\")").size last_issues['filter_data_id'] = current_number_issues send_event(filter_data_id, { current: current_number_issues, last: last_issues['filter_data_id']}) end end
the problem have wish schedule part gets "last_number_issues" every 2 hours, rest of every 10 minutes can work out whether number has gone or down in 2 hour time frame.
any ideas?
you set 2 schedulers in job this
scheduler.every '10m', :first_in => 0 |job| # code here end scheduler.every '2h', :first_in => 0 |job| # code here end
this way can seperate logic "last_number_issues" own schedule.
Comments
Post a Comment