diff options
author | Victor Toso <me@victortoso.com> | 2016-09-15 17:36:26 +0200 |
---|---|---|
committer | Victor Toso <me@victortoso.com> | 2016-09-22 10:09:31 +0200 |
commit | ca91b2823643aa963837776a82147693e448c6cc (patch) | |
tree | c2e62c0beedda6faa9438a9f50aa8c600017cdae | |
parent | e60b6390fae94601822239455747982d114496ac (diff) | |
download | grilo-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.c | 7 |
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); |