mercredi 19 août 2015

dashing rufus scheduler updating two different values

I'm using dashing to display some information taken from Jira bug tracking system.

Using the plugin: http://ift.tt/1NlpBxH

I have a ruby script that gets the number of Jira issues based on a filter, for each filter in a list. This then gets pushed to 3 number widgets each displaying a different filter.

require 'jira'

last_issues = Hash.new(6)

JIRA_FILTERS.each do |filter_data_id, filter|
    SCHEDULER.every '5s', :first_in => 0 do |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 I have is that I wish to schedule the part that gets the "last_number_issues" every 2 hours, but the rest of it every 10 minutes so I can work out whether the number has gone up or down in that 2 hour time frame.

Any ideas?

Aucun commentaire:

Enregistrer un commentaire