Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto retry on interval #439

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions core/cog-webkit-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ static const char error_message_template[] =
" margin-left: 0.75em; margin-top: 0 }\n"
".try-again { text-align: center; font-size: 1em; \n"
" height: 100%; margin: 1em; }\n"
"</style></head><body>\n"
"</style>\n"
"<script>\nfunction retry() { window.location.href = '%s' }\n"
"setTimeout(retry, 5000);\n</script></head><body>\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This make the “retry every five seconds” behaviour unconditional, and I can imagine there may be cases in which this is not desired. It would be better if we could have an option to configure (or disable) the retry interval.

Copy link
Contributor Author

@EinarArnason EinarArnason May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, an option would be best. Should it be disabled by default?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, disabled by default would keep the current behaviour by default, to avoid breaking people's setups. Thanks for considering reworking the patch 😸

" <h3>%s</h3>\n"
" <p class='uri'>%s</p>\n"
" <p>%s</p>\n"
"<button onclick=\"window.location.href = '%s'\" class=\"try-again\">Try again</button>"
"<button onclick=\"retry()\" class=\"try-again\">Try again</button>"
"</body></html>";

gboolean
Expand All @@ -34,7 +36,7 @@ load_error_page (WebKitWebView *web_view,
{
g_warning ("<%s> %s: %s", failing_uri, title, message);

g_autofree char *html = g_strdup_printf(error_message_template, title, title, failing_uri, message, failing_uri);
g_autofree char *html = g_strdup_printf(error_message_template, title, failing_uri, title, failing_uri, message);
webkit_web_view_load_alternate_html (web_view,
html,
failing_uri,
Expand Down