소스 검색

MailFetcher : rename delay -> heartbeat

Guénaël Muller 6 년 전
부모
커밋
b43afaf1a3
2개의 변경된 파일8개의 추가작업 그리고 8개의 파일을 삭제
  1. 1 1
      tracim/tracim/lib/daemons.py
  2. 7 7
      tracim/tracim/lib/email_fetcher.py

+ 1 - 1
tracim/tracim/lib/daemons.py 파일 보기

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

+ 7 - 7
tracim/tracim/lib/email_fetcher.py 파일 보기

@@ -161,7 +161,7 @@ class MailFetcher(object):
161 161
         folder: str,
162 162
         use_idle: bool,
163 163
         connection_max_lifetime: int,
164
-        delay: int,
164
+        heartbeat: int,
165 165
         endpoint: str,
166 166
         token: str,
167 167
         use_html_parsing: bool,
@@ -179,7 +179,7 @@ class MailFetcher(object):
179 179
         :param use_ssl: use imap over ssl connection
180 180
         :param folder: mail folder where new mail are fetched
181 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 183
         :param connection_max_lifetime: maximum duration allowed for a connection.
184 184
            connection is automatically renew when his lifetime excess this value
185 185
         :param endpoint: tracim http endpoint where decoded mail are send.
@@ -193,7 +193,7 @@ class MailFetcher(object):
193 193
         self.password = password
194 194
         self.use_ssl = use_ssl
195 195
         self.folder = folder
196
-        self.delay = delay
196
+        self.heartbeat = heartbeat
197 197
         self.use_idle = use_idle
198 198
         self.connection_max_lifetime = connection_max_lifetime
199 199
         self.endpoint = endpoint
@@ -217,8 +217,8 @@ class MailFetcher(object):
217 217
             except Exception as e:
218 218
                 log = 'Fail to connect to IMAP {}'
219 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 222
                 continue
223 223
 
224 224
             # fetching
@@ -250,8 +250,8 @@ class MailFetcher(object):
250 250
                                   'support it, use polling instead.'
251 251
                             logger.warning(self, log)
252 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 256
                 logger.debug(self,"Lifetime limit excess, Renew connection")
257 257
             except filelock.Timeout as e: