aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libbugzilla.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-09-09 15:09:22 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-10-30 11:05:51 +0100
commitcdcd7c4aa1c8027862146e56dcc02cfa9f99b379 (patch)
tree0b8083aac595265c52d920d28efa3893e5a87538 /lib/libbugzilla.js
parent1e6d766e5a900973113d747503e2317676c751e0 (diff)
downloadbugzilla-triage-cdcd7c4aa1c8027862146e56dcc02cfa9f99b379.tar.gz
The first version of CachedRequest.
Diffstat (limited to 'lib/libbugzilla.js')
-rw-r--r--lib/libbugzilla.js40
1 files changed, 37 insertions, 3 deletions
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js
index 03ae6eb..d931a91 100644
--- a/lib/libbugzilla.js
+++ b/lib/libbugzilla.js
@@ -14,6 +14,7 @@ var urlMod = require("url");
var xhrMod = require("xhr");
var panelMod = require("panel");
var myStorage = require("simple-storage");
+var CachedRequest = require("cached-request").CachedRequest;
var JSONURLDefault = "https://fedorahosted.org/released"+
"/bugzilla-triage-scripts/Config_data.json";
@@ -25,7 +26,7 @@ var copiedAttributes = [ "queryButton", "upstreamButton", "parseAbrtBacktraces",
var config = exports.config = {};
-var debugOption = null;
+var debugOption = true;
function Message(cmd, data) {
debug("Message: cmd = " + cmd + ", data = " + data);
@@ -340,8 +341,15 @@ function loginToAllBugzillas(callback) {
// Increment call counter
loginCallsCounter++;
});
+<<<<<<< HEAD
if (loginCallsCounter == 0) {
debug("No credentials!");
+=======
+ // loginCallsCounter is here approx. number of calls which
+ // were started; zero means we have no passwords at
+ // all, thus we have to run callback directly.
+ if (loginCallsCounter == 0) {
+>>>>>>> The first version of CachedRequest.
callback(config);
}
},
@@ -382,6 +390,20 @@ var makeJSONRPCCall = exports.makeJSONRPCCall = function makeJSONRPCCall(url, me
}).post();
};
+<<<<<<< HEAD
+=======
+function processPageModeREs() {
+ var confD = config.configData;
+ if (confD.bugPageMatchStr) {
+ ['bugPageMatch', 'skipMatch'].forEach(function (key) {
+ confD[key] = confD[key+"Str"].map(function (REStr) {
+ return new RegExp(REStr);
+ });
+ });
+ }
+}
+
+>>>>>>> The first version of CachedRequest.
/**
* Preprocess JSON into config data structure.
*
@@ -514,8 +536,20 @@ exports.initialize = function initialize(callback) {
var urlStr = preferences.get(prefJSONURLName, JSONURLDefault);
preferences.set(prefJSONURLName, urlStr);
- debug("Starting initialize!");
- fetchConfigurationJSON(urlStr, callback);
+ CachedRequest({
+ url: urlStr,
+ getExpiredAnyway: true,
+ onComplete: function (response) {
+ if (response.status == 200) {
+ processConfigJSON(response.json);
+ if (("submitsLogging" in config.gJSONData.configData) &&
+ config.gJSONData.configData.submitsLogging) {
+ logger.initialize();
+ }
+ loginToAllBugzillas(callback);
+ }
+ }
+ });
}
//vim: set ts=2 et sw=2 textwidth=80: