summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Toso <me@victortoso.com>2016-09-15 17:36:26 +0200
committerVictor Toso <me@victortoso.com>2016-09-22 10:09:31 +0200
commitca91b2823643aa963837776a82147693e448c6cc (patch)
treec2e62c0beedda6faa9438a9f50aa8c600017cdae
parente60b6390fae94601822239455747982d114496ac (diff)
downloadgrilo-ca91b2823643aa963837776a82147693e448c6cc.tar.gz
net: Check for throttling only if set
Otherwise, we might add several 0 seconds delay on multiple fetch requests leading to unexpected behavior (assertion) https://bugzilla.gnome.org/show_bug.cgi?id=771338
-rw-r--r--libs/net/grl-net-wc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/net/grl-net-wc.c b/libs/net/grl-net-wc.c
index 8ed4dc2..8d7c186 100644
--- a/libs/net/grl-net-wc.c
+++ b/libs/net/grl-net-wc.c
@@ -760,8 +760,11 @@ get_url (GrlNetWc *self,
g_get_current_time (&now);
- if ((now.tv_sec - priv->last_request.tv_sec) > priv->throttling
- || is_mocked()) {
+ /* If grl-net-wc is not mocked, we need to check if throttling is set
+ * otherwise the throttling delay check would always be true */
+ if (is_mocked ()
+ || priv->throttling == 0
+ || (now.tv_sec - priv->last_request.tv_sec) > priv->throttling) {
priv->last_request = now;
id = g_idle_add_full (G_PRIORITY_HIGH_IDLE,
get_url_cb, c, request_clos_destroy);