Commit 17c390c7 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

[erp5_web_monitoring] set timeout value to prevent stalled sync on bad URL

parent e6ddd213
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
type: "replicatedopml", type: "replicatedopml",
remote_storage_unreachable_status: "WARNING", remote_storage_unreachable_status: "WARNING",
remote_opml_check_time_interval: 86400000, remote_opml_check_time_interval: 86400000,
request_timeout: 25000, // timeout is to 25 second
local_sub_storage: { local_sub_storage: {
type: "query", type: "query",
sub_storage: { sub_storage: {
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.48734.54444.887</string> </value> <value> <string>964.14420.61705.7611</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1507899173.02</float> <float>1513617981.41</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
* "type": "replicatedopml", * "type": "replicatedopml",
* "remote_storage_unreachable_status": "WARNING", * "remote_storage_unreachable_status": "WARNING",
* "remote_opml_check_time_interval": 86400000, * "remote_opml_check_time_interval": 86400000,
* "request_timeout": 0,
* local_sub_storage: { * local_sub_storage: {
* type: "query", * type: "query",
* sub_storage: { * sub_storage: {
...@@ -73,6 +74,10 @@ ...@@ -73,6 +74,10 @@
// one day in miliseconds // one day in miliseconds
this._remote_opml_check_time_interval = 86400000; this._remote_opml_check_time_interval = 86400000;
} }
this._request_timeout = spec.request_timeout;
if (this._request_timeout === undefined) {
this._request_timeout = 0; // no timeout
}
} }
ReplicatedOPMLStorage.prototype.get = function () { ReplicatedOPMLStorage.prototype.get = function () {
...@@ -446,7 +451,8 @@ ...@@ -446,7 +451,8 @@
attachment_id: 'enclosure', attachment_id: 'enclosure',
parser: 'rss', parser: 'rss',
sub_storage: { sub_storage: {
type: "http" type: "http",
timeout: context._request_timeout
} }
}, },
id_hash, id_hash,
...@@ -459,7 +465,8 @@ ...@@ -459,7 +465,8 @@
{ {
type: 'webhttp', type: 'webhttp',
url: item.doc.url.replace('jio_private', 'private'), url: item.doc.url.replace('jio_private', 'private'),
basic_login: basic_login basic_login: basic_login,
timeout: context._request_timeout
}, },
id_hash id_hash
)); ));
...@@ -701,7 +708,8 @@ ...@@ -701,7 +708,8 @@
attachment_id: 'enclosure', attachment_id: 'enclosure',
parser: 'opml', parser: 'opml',
sub_storage: { sub_storage: {
type: "http" type: "http",
timeout: context._request_timeout
} }
}, },
storage_spec.basic_login storage_spec.basic_login
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.31914.46636.11724</string> </value> <value> <string>964.6864.64042.34201</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1510928894.69</float> <float>1513173747.08</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
} }
options.xhrFields.withCredentials = storage._with_credentials; options.xhrFields.withCredentials = storage._with_credentials;
} }
if (storage._timeout !== undefined) {
options.timeout = storage._timeout;
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return jIO.util.ajax(options); return jIO.util.ajax(options);
...@@ -81,6 +84,7 @@ ...@@ -81,6 +84,7 @@
this._authorization = "Basic " + spec.basic_login; this._authorization = "Basic " + spec.basic_login;
} }
this._with_credentials = spec.with_credentials; this._with_credentials = spec.with_credentials;
this._timeout = spec.timeout;
} }
WEBHTTPStorage.prototype.get = function (id) { WEBHTTPStorage.prototype.get = function (id) {
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.21931.50854.43776</string> </value> <value> <string>963.27666.8050.30907</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1502445069.19</float> <float>1513173954.77</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment