| |
@@ -23,7 +23,7 @@
|
| |
|
| |
import urllib.parse
|
| |
|
| |
- from oraculum import CACHE, BUGZILLA
|
| |
+ from oraculum import app, celery_app, CACHE, BUGZILLA
|
| |
from oraculum.utils.dashboard_helpers import release_from_number
|
| |
|
| |
|
| |
@@ -78,8 +78,21 @@
|
| |
Returns all open Bugs for a single package
|
| |
"""
|
| |
data = []
|
| |
- # Try to get the since value from db if we already have something
|
| |
- since = CACHE.get_refreshed_time("packager-dashboard__all_package_bugs", package)
|
| |
+
|
| |
+ # Get BZ sync counter to decide if it's a time to do a full blown sync
|
| |
+ # For later us or other oraculum maintainers:
|
| |
+ # We can't pass this as a function parameter as our caching architecture is saving and getting data
|
| |
+ # from the database according to provider, which includes also the function arguments
|
| |
+ redis_conn = celery_app.broker_connection().default_channel.client
|
| |
+ counter = int(redis_conn.get("bz_sync_mode_counter")) or 1
|
| |
+
|
| |
+ if counter % app.config["BZ_FULL_EVERY_N_TIMES"] == 0:
|
| |
+ # # Refresh the whole bugzilla
|
| |
+ since = False
|
| |
+ else:
|
| |
+ # Try to get the since value from db if we already have something
|
| |
+ since = CACHE.get_refreshed_time("packager-dashboard__all_package_bugs", package)
|
| |
+
|
| |
if since:
|
| |
# Let's have a faster BZ if we have something in db
|
| |
since = since.strftime("%Y-%m-%d")
|
| |
Fixes https://pagure.io/fedora-qa/packager_dashboard/issue/93