Skip to content

Commit 3939081

Browse files
committed
Increase api timeout to 30 seconds. Formatting.
1 parent c27fcf9 commit 3939081

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

dev/src/net/Server.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import Utils from "../utils/Utils";
2020
import app from "../app";
2121

2222
export default class Server {
23-
23+
2424
// regex:
2525
static solve(req) {
2626
return Server._getRequest("regex/solve", {data: JSON.stringify(req)});
2727
}
28-
28+
2929
static version(flavor) {
3030
return Server._getRequest("regex/version", {flavor:flavor});
3131
}
@@ -34,11 +34,11 @@ export default class Server {
3434
static communitySearch(str) {
3535
return Server._getRequest("patterns/search", {query:str||"", startIndex:0, limit:100}, (data) => { this._processPatternList(data); });
3636
}
37-
37+
3838
static load(id) {
3939
return Server._getRequest("patterns/load", {patternId:id}, (data) => this._processPattern(data));
4040
}
41-
41+
4242
static save(pattern, fork, community) {
4343
// clone and prep the pattern object:
4444
let o = this._prepPattern(pattern, fork, community);
@@ -48,15 +48,15 @@ export default class Server {
4848
static rate(id, rating) {
4949
return Server._getRequest("patterns/rate", {patternId:id, userRating:rating}, (data) => data.rating = Number(data.rating));
5050
}
51-
51+
5252
static delete(id) {
5353
return Server._getRequest("patterns/delete", {patternId:id});
5454
}
55-
55+
5656
static favorite(id, value) {
5757
return Server._getRequest("patterns/favorite", {patternId:id, favorite:!!value});
5858
}
59-
59+
6060
static private(id, value) {
6161
return Server.setAccess(id, value ? "private" : "protected");
6262
}
@@ -77,7 +77,7 @@ export default class Server {
7777
static logout() {
7878
return Server._getRequest("account/logout", {});
7979
}
80-
80+
8181
static verify() {
8282
return Server._getRequest("account/verify", {});
8383
}
@@ -127,9 +127,9 @@ export default class Server {
127127
let req = new XMLHttpRequest(), p = new ServerPromise(req, postprocess), params = [];
128128
req.open("POST", Server.url);
129129
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded", true);
130-
req.timeout = 5000;
130+
req.timeout = 30*1000;
131131
data.action = action;
132-
132+
133133
if (Server.isLocal && Server.useBeta) { data.userId = 111; }
134134
for (let n in data) { params.push(n + "=" + encodeURIComponent(data[n])); }
135135
if (Server.isLocal) { console.log(data); }
@@ -154,7 +154,7 @@ class ServerPromise {
154154
if (ff) { this.finally(ff); }
155155
return this;
156156
}
157-
157+
158158
catch(f) {
159159
this._errorF = f;
160160
if (this._err) { f(this._err); }
@@ -166,15 +166,15 @@ class ServerPromise {
166166
if (this._complete) { f(); }
167167
return this;
168168
}
169-
169+
170170
abort() {
171171
if (this._complete) { return; }
172172
this._complete = true;
173173
this._req.abort();
174174
this._finallyF && this._finallyF();
175175
this._loadF = this._errorF = this._finallyF = null; // just to make sure.
176176
}
177-
177+
178178
_load() {
179179
let json;
180180
this._complete = true;
@@ -187,7 +187,7 @@ class ServerPromise {
187187
this._loadF && this._loadF(this._data);
188188
this._finallyF && this._finallyF();
189189
}
190-
190+
191191
_error(e) {
192192
this._err = (e.data && e.data.error) || e.message || e.detail || e.type || String(e);
193193
this._errorF && this._errorF(this._err);
@@ -198,4 +198,4 @@ class ServerPromise {
198198
Server.isLocal = Utils.isLocal;
199199
Server.useBeta = Server.isLocal || (window.location.hostname === "beta.regexr.com");
200200
Server.host = "https://" + (Server.useBeta ? "beta." : "") + "regexr.com"
201-
Server.url = Server.host + "/server/api.php";
201+
Server.url = Server.host + "/server/api.php";

0 commit comments

Comments
 (0)