Explorar el Código

filelock timeout as constant

Guénaël Muller hace 7 años
padre
commit
3dcee3fdf9
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      tracim/tracim/lib/email_fetcher.py

+ 5 - 1
tracim/tracim/lib/email_fetcher.py Ver fichero

@@ -24,6 +24,8 @@ CONTENT_TYPE_TEXT_HTML = 'text/html'
24 24
 
25 25
 IMAP_SEEN_FLAG = '\\Seen'
26 26
 IMAP_CHECKED_FLAG = '\\Flagged'
27
+MAIL_FETCHER_FILELOCK_TIMEOUT = 10
28
+
27 29
 
28 30
 class MessageContainer(object):
29 31
     def __init__(self, message: Message, uid: int) -> None:
@@ -196,7 +198,9 @@ class MailFetcher(object):
196 198
             time.sleep(self.delay)
197 199
             try:
198 200
                 self._connect()
199
-                with self.lock.acquire(timeout=10):
201
+                with self.lock.acquire(
202
+                        timeout=MAIL_FETCHER_FILELOCK_TIMEOUT
203
+                ):
200 204
                     messages = self._fetch()
201 205
                 cleaned_mails = [DecodedMail(m.message, m.uid)
202 206
                                  for m in messages]