#162 get_bz_query: use last_update_string for bug creation too
Merged 4 years ago by kparal. Opened 4 years ago by adamwill.
fedora-qa/ adamwill/blockerbugs bug-creation-ts  into  develop

@@ -76,17 +76,11 @@ 

              query['keywords'] = 'Triaged'

          if last_update:

              last_update_string = last_update.strftime("%Y-%m-%d %H:%M GMT")

-             yesterday_timestring = (last_update - datetime.timedelta(days=1)).strftime("%Y-%m-%d")

  

              # Since this is kind of confusing, the idea here is to only grab only

              # the bugs whose whiteboard, blocks or dependson has changed since

              # the last sync or any bugs that have been created in the last day.

  

-             # Unfortunately, there doesn't seem to be a way to filter the created

-             # bugs in a way that's more granular than a day, so we'll pull in

-             # extra bugs and slow down the sync process but the alternative is

-             # missing bugs from the list

- 

              # keep in mind that OP -> open parenthesis, CP -> closed parenthesis

              # and the OR is to make sure that a bug is returned if ANY of the

              # changed after conditions are met
@@ -107,7 +101,7 @@ 

                  'v6': last_update_string,

                  'f7': 'creation_ts',

                  'o7': 'greaterthaneq',

-                 'v7': yesterday_timestring,

+                 'v7': last_update_string,

                  'f8': 'short_desc',

                  'o8': 'changedafter',

                  'v8': last_update_string,

The comment from @tflink saying this doesn't work, which this
commit removes, seems to be no longer valid. I tested using a
query for creation_ts greaterthaneq "2020-11-27" and then making
it "2020-11-27 16:00 GMT"; the former gave 202 results, the
latter gave 101. That looks a lot like it works.

Signed-off-by: Adam Williamson awilliam@redhat.com

Review from @tflink would be appreciated if he remembers this at all :) This is the test I did:

>>> import bugzilla
>>> bz = bugzilla.RHBugzilla4("https://bugzilla.redhat.com/xmlrpc.cgi")
>>> query = {'f1': 'OP', 'f2': 'creation_ts', 'o2': 'greaterthaneq', 'v2': "2020-11-27", 'f3': 'CP'}
>>> len(bz.query(query))
202
>>> query = {'f1': 'OP', 'f2': 'creation_ts', 'o2': 'greaterthaneq', 'v2': "2020-11-27 16:00 GMT", 'f3': 'CP'}
>>> len(bz.query(query))
101

I wrote this after looking at the timeouts we're getting on sync (see emails to sysadmin-qa), but it will only help if we're not doing a full sync. I'm not sure off the top of my head whether we are.

Build succeeded.

The diff looks good on paper.

@tflink Any thoughts about this?

It's been 8-ish years since that code was written, glad to see that bugzilla has improved in this way.

If the code works, I have no objections. I think that it did something obviously wrong when I used to use the whole timestamp, the test that @adamwill did shows that's no longer the case.

We should only do full syncs when forced or when initializing the database. I don't think that has changed, anyways.

Either way, +1 from me

Commit 924266d fixes this pull-request

Pull-Request has been merged by kparal

4 years ago