Abort pending request(s), before adding a new one.

merge-requests/218/head
Jens Lody 9 years ago
parent d7f20d047d
commit c381fbf689
  1. 4
      src/extension.js

@ -1030,12 +1030,14 @@ const OpenweatherMenuButton = new Lang.Class({
if (_httpSession === undefined) { if (_httpSession === undefined) {
_httpSession = new Soup.Session(); _httpSession = new Soup.Session();
_httpSession.user_agent = this.user_agent; _httpSession.user_agent = this.user_agent;
} else {
// abort previous requests.
_httpSession.abort();
} }
let message = Soup.form_request_new_from_hash('GET', url, params); let message = Soup.form_request_new_from_hash('GET', url, params);
_httpSession.queue_message(message, Lang.bind(this, function(_httpSession, message) { _httpSession.queue_message(message, Lang.bind(this, function(_httpSession, message) {
try { try {
if (!message.response_body.data) { if (!message.response_body.data) {
fun.call(this, 0); fun.call(this, 0);

Loading…
Cancel
Save