Browse Source

MailFetcher : rename delay -> heartbeat

Guénaël Muller 7 years ago
parent
commit
b43afaf1a3
2 changed files with 8 additions and 8 deletions
  1. 1 1
      tracim/tracim/lib/daemons.py
  2. 7 7
      tracim/tracim/lib/email_fetcher.py

+ 1 - 1
tracim/tracim/lib/daemons.py View File

173
             password=cfg.EMAIL_REPLY_IMAP_PASSWORD,
173
             password=cfg.EMAIL_REPLY_IMAP_PASSWORD,
174
             use_ssl=cfg.EMAIL_REPLY_IMAP_USE_SSL,
174
             use_ssl=cfg.EMAIL_REPLY_IMAP_USE_SSL,
175
             folder=cfg.EMAIL_REPLY_IMAP_FOLDER,
175
             folder=cfg.EMAIL_REPLY_IMAP_FOLDER,
176
-            delay=cfg.EMAIL_REPLY_CHECK_HEARTBEAT,
176
+            heartbeat=cfg.EMAIL_REPLY_CHECK_HEARTBEAT,
177
             use_idle=cfg.EMAIL_REPLY_IMAP_USE_IDLE,
177
             use_idle=cfg.EMAIL_REPLY_IMAP_USE_IDLE,
178
             connection_max_lifetime=cfg.EMAIL_REPLY_CONNECTION_MAX_LIFETIME,
178
             connection_max_lifetime=cfg.EMAIL_REPLY_CONNECTION_MAX_LIFETIME,
179
             # FIXME - G.M - 2017-11-15 - proper tracim url formatting
179
             # FIXME - G.M - 2017-11-15 - proper tracim url formatting

+ 7 - 7
tracim/tracim/lib/email_fetcher.py View File

161
         folder: str,
161
         folder: str,
162
         use_idle: bool,
162
         use_idle: bool,
163
         connection_max_lifetime: int,
163
         connection_max_lifetime: int,
164
-        delay: int,
164
+        heartbeat: int,
165
         endpoint: str,
165
         endpoint: str,
166
         token: str,
166
         token: str,
167
         use_html_parsing: bool,
167
         use_html_parsing: bool,
179
         :param use_ssl: use imap over ssl connection
179
         :param use_ssl: use imap over ssl connection
180
         :param folder: mail folder where new mail are fetched
180
         :param folder: mail folder where new mail are fetched
181
         :param use_idle: use IMAP IDLE(server notification) when available
181
         :param use_idle: use IMAP IDLE(server notification) when available
182
-        :param delay: seconds to wait before fetching new mail again
182
+        :param heartbeat: seconds to wait before fetching new mail again
183
         :param connection_max_lifetime: maximum duration allowed for a connection.
183
         :param connection_max_lifetime: maximum duration allowed for a connection.
184
            connection is automatically renew when his lifetime excess this value
184
            connection is automatically renew when his lifetime excess this value
185
         :param endpoint: tracim http endpoint where decoded mail are send.
185
         :param endpoint: tracim http endpoint where decoded mail are send.
193
         self.password = password
193
         self.password = password
194
         self.use_ssl = use_ssl
194
         self.use_ssl = use_ssl
195
         self.folder = folder
195
         self.folder = folder
196
-        self.delay = delay
196
+        self.heartbeat = heartbeat
197
         self.use_idle = use_idle
197
         self.use_idle = use_idle
198
         self.connection_max_lifetime = connection_max_lifetime
198
         self.connection_max_lifetime = connection_max_lifetime
199
         self.endpoint = endpoint
199
         self.endpoint = endpoint
217
             except Exception as e:
217
             except Exception as e:
218
                 log = 'Fail to connect to IMAP {}'
218
                 log = 'Fail to connect to IMAP {}'
219
                 logger.error(self, log.format(e.__str__()))
219
                 logger.error(self, log.format(e.__str__()))
220
-                logger.debug(self, 'sleep for {}'.format(self.delay))
221
-                time.sleep(self.delay)
220
+                logger.debug(self, 'sleep for {}'.format(self.heartbeat))
221
+                time.sleep(self.heartbeat)
222
                 continue
222
                 continue
223
 
223
 
224
             # fetching
224
             # fetching
250
                                   'support it, use polling instead.'
250
                                   'support it, use polling instead.'
251
                             logger.warning(self, log)
251
                             logger.warning(self, log)
252
                         # normal polling mode : sleep a define duration
252
                         # normal polling mode : sleep a define duration
253
-                        logger.debug(self, 'sleep for {}'.format(self.delay))
254
-                        time.sleep(self.delay)
253
+                        logger.debug(self, 'sleep for {}'.format(self.heartbeat))
254
+                        time.sleep(self.heartbeat)
255
 
255
 
256
                 logger.debug(self,"Lifetime limit excess, Renew connection")
256
                 logger.debug(self,"Lifetime limit excess, Renew connection")
257
             except filelock.Timeout as e:
257
             except filelock.Timeout as e: