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

Application exit on connection failure #28

Open
IngoMeyer441 opened this issue Mar 17, 2022 · 1 comment
Open

Application exit on connection failure #28

IngoMeyer441 opened this issue Mar 17, 2022 · 1 comment

Comments

@IngoMeyer441
Copy link

Currently, the application exits when one account could not connect to the mail server. Wouldn't it be better to run another connection attempt after a short time period?

I think of these kind of changes:

diff --git a/ayatanawebmail/application.py b/ayatanawebmail/application.py
index 917fb3b..c17c4c8 100755
--- a/ayatanawebmail/application.py
+++ b/ayatanawebmail/application.py
@@ -1102,12 +1102,15 @@ class AyatanaWebmail(object):
 
                     logger.error('"{0}:{1}" could not connect: {2}'.format(oConnection.strLogin, oConnection.strFolder, str(oException)))
 
+                    oConnection.bConnecting = True
+                    GLib.timeout_add_seconds(1, oConnection.close)
+                    logger.info('"{0}:{1}" will try to reconnect in 1 minute.'.format(oConnection.strLogin, oConnection.strFolder))
+                    GLib.timeout_add_seconds(60, self.connect, [oConnection])
+
                     oNotification = Notify.Notification.new(_('Connection error'), '', APPNAME)
-                    oNotification.set_property('body', _('Unable to connect to account "{accountName}", the application will now exit.').format(accountName=oConnection.strLogin))
+                    oNotification.set_property('body', _('Unable to connect to account "{accountName}", will try to reconnect in 1 minute.').format(accountName=oConnection.strLogin))
                     oNotification.set_hint('desktop-entry', GLib.Variant.new_string(APPNAME))
-                    oNotification.set_timeout(Notify.EXPIRES_NEVER)
                     oNotification.show()
-                    self.close(1)
 
         return False
 

What do you think about this?

@tari01
Copy link
Member

tari01 commented Mar 17, 2022

@IngoMeyer441

Many moons ago, when this application was still fresh, I added this as a final catch for a case when it could not recover by simply reconnecting everything.

I really don't remember why the exit was needed back then (sorry).

Perhaps with all the code changes over the years, it is now possible to avoid exiting. We should really stress-test your proposal, and if it really works, merge it as a PR.

Currently, the application exits when one account could not connect to the mail server. Wouldn't it be better to run another connection attempt after a short time period?

I think of these kind of changes:

diff --git a/ayatanawebmail/application.py b/ayatanawebmail/application.py
index 917fb3b..c17c4c8 100755
--- a/ayatanawebmail/application.py
+++ b/ayatanawebmail/application.py
@@ -1102,12 +1102,15 @@ class AyatanaWebmail(object):
 
                     logger.error('"{0}:{1}" could not connect: {2}'.format(oConnection.strLogin, oConnection.strFolder, str(oException)))
 
+                    oConnection.bConnecting = True
+                    GLib.timeout_add_seconds(1, oConnection.close)
+                    logger.info('"{0}:{1}" will try to reconnect in 1 minute.'.format(oConnection.strLogin, oConnection.strFolder))
+                    GLib.timeout_add_seconds(60, self.connect, [oConnection])
+
                     oNotification = Notify.Notification.new(_('Connection error'), '', APPNAME)
-                    oNotification.set_property('body', _('Unable to connect to account "{accountName}", the application will now exit.').format(accountName=oConnection.strLogin))
+                    oNotification.set_property('body', _('Unable to connect to account "{accountName}", will try to reconnect in 1 minute.').format(accountName=oConnection.strLogin))
                     oNotification.set_hint('desktop-entry', GLib.Variant.new_string(APPNAME))
-                    oNotification.set_timeout(Notify.EXPIRES_NEVER)
                     oNotification.show()
-                    self.close(1)
 
         return False
 

What do you think about this?

#28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants