[polari] thumbnailer: Limit time we try to load a page
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] thumbnailer: Limit time we try to load a page
- Date: Wed, 18 Dec 2019 01:53:43 +0000 (UTC)
commit 75d6470ce94f984fc1c61122da35ad50b39bf3f7
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Dec 16 14:16:45 2019 +0100
thumbnailer: Limit time we try to load a page
We don't want to allow a single URL to block all further preview generation
indefinitely, so cancel loading after a minute.
https://gitlab.gnome.org/GNOME/polari/merge_requests/139
src/thumbnailer.js | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/src/thumbnailer.js b/src/thumbnailer.js
index 6948ae9..4a54548 100644
--- a/src/thumbnailer.js
+++ b/src/thumbnailer.js
@@ -38,6 +38,11 @@ let PreviewWindow = GObject.registerClass({
this._onLoadingChanged.bind(this));
this._view.connect('load-failed', () => this.emit('snapshot-failed'));
this._view.load_uri(this.uri);
+
+ GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 60, () => {
+ this._view.stop_loading();
+ return GLib.SOURCE_REMOVE;
+ });
}
_onLoadingChanged() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]