diff options
author | 2008-06-03 05:40:19 +0200 | |
---|---|---|
committer | 2008-06-03 05:40:19 +0200 | |
commit | 515d52f0cf133254f4315b230aa8016b8521cd29 (patch) | |
tree | c76b309d9c8449ee2d41895b1618cb7611b62239 | |
parent | Make sure that the last seen ID is used, so the full list of bugs is requeste... (diff) | |
download | rbot-bugzilla-515d52f0cf133254f4315b230aa8016b8521cd29.tar.gz rbot-bugzilla-515d52f0cf133254f4315b230aa8016b8521cd29.tar.bz2 rbot-bugzilla-515d52f0cf133254f4315b230aa8016b8521cd29.zip |
Make announcement less greedy: on the first run ask only for bugs open in the last six hours.
-rw-r--r-- | bugzilla.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bugzilla.rb b/bugzilla.rb index fb8f8fb..e013ba6 100644 --- a/bugzilla.rb +++ b/bugzilla.rb @@ -158,10 +158,7 @@ class BugzillaPlugin < Plugin end def lastseenid - retval = @registry["zilla.#{name}.lastseenid"] - return 0 if retval == nil - - return retval + return @registry["zilla.#{name}.lastseenid"] end def lastseenid=(val) @@ -270,7 +267,16 @@ class BugzillaPlugin < Plugin end def announce(bot) - buglist = CSV::Reader.create(client.get_content("#{baseurl}/buglist.cgi?ctype=csv&field0-0-0=bug_id&query_format=advaced&remaction=&type0-0-0=greaterthan&value0-0-0=#{lastseenid}&order=bugs.bug_id")).to_a + buglist_url = baseurl + + "/buglist.cgi?ctype=csv&order=bugs.bug_id" + + if lastseenid == nil + buglist_url += "&chfieldfrom=-6h&chfieldto=Now&chfield=%5BBug+creation%5D" + else + buglist_url += "&field0-0-0=bug_id&remaction=&type0-0-0=greaterthan&value0-0-0=#{lastseenid}" + end + + buglist = CSV::Reader.create(client.get_content(buglist_url)).to_a buglist.delete_at(0) upper_bound = [buglist.size, 5].min buglist[-upper_bound..-1].each do |bug| |