mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-11 02:30:21 +08:00
[iso-core] (imap-P2) Actually fix constant socket timeout errors 😢
Summary: Remember how we made it so imap socket timeouts would increment up to 10m if we constantly got timeout errors? Remember how we told everyone in https://github.com/nylas/nylas-mail/issues/3232 that we'd fixed their problems, but they weren't actually fixed? Well, we weren't /actually/ applying the correct timeout value. 😢 Depends on D4033 Test Plan: manual Reviewers: spang, halla, mark, evan Reviewed By: mark, evan Differential Revision: https://phab.nylas.com/D4035
This commit is contained in:
parent
a2e0b81493
commit
18095cac3e
1 changed files with 5 additions and 5 deletions
|
@ -31,12 +31,12 @@ const Capabilities = {
|
|||
}
|
||||
|
||||
const ONE_HOUR_SECS = 60 * 60;
|
||||
const SOCKET_TIMEOUT_MS = 30 * 1000;
|
||||
const AUTH_TIMEOUT_MS = 30 * 1000;
|
||||
const DEFAULT_SOCKET_TIMEOUT_MS = 30 * 1000;
|
||||
|
||||
class IMAPConnection extends EventEmitter {
|
||||
|
||||
static DefaultSocketTimeout = SOCKET_TIMEOUT_MS;
|
||||
static DefaultSocketTimeout = DEFAULT_SOCKET_TIMEOUT_MS;
|
||||
|
||||
static connect(...args) {
|
||||
return new IMAPConnection(...args).connect()
|
||||
|
@ -56,7 +56,7 @@ class IMAPConnection extends EventEmitter {
|
|||
user: baseSettings.imap_username,
|
||||
password: baseSettings.imap_password,
|
||||
tls: baseSettings.ssl_required,
|
||||
socketTimeout: baseSettings.socketTimeout || SOCKET_TIMEOUT_MS,
|
||||
socketTimeout: baseSettings.socketTimeout || DEFAULT_SOCKET_TIMEOUT_MS,
|
||||
authTimeout: baseSettings.authTimeout || AUTH_TIMEOUT_MS,
|
||||
}
|
||||
if (!MAJOR_IMAP_PROVIDER_HOSTS.has(settings.host)) {
|
||||
|
@ -156,7 +156,7 @@ class IMAPConnection extends EventEmitter {
|
|||
|
||||
const socketTimeout = setTimeout(() => {
|
||||
reject(new IMAPConnectionTimeoutError('Socket timed out'))
|
||||
}, SOCKET_TIMEOUT_MS)
|
||||
}, this._resolvedSettings.socketTimeout)
|
||||
|
||||
// Emitted when new mail arrives in the currently open mailbox.
|
||||
let lastMailEventBox = null;
|
||||
|
@ -338,7 +338,7 @@ class IMAPConnection extends EventEmitter {
|
|||
return new Promise((resolve, reject) => {
|
||||
const socketTimeout = setTimeout(() => {
|
||||
reject(new IMAPConnectionTimeoutError('Socket timed out'))
|
||||
}, SOCKET_TIMEOUT_MS)
|
||||
}, this._resolvedSettings.socketTimeout)
|
||||
|
||||
onEnded = () => {
|
||||
clearTimeout(socketTimeout)
|
||||
|
|
Loading…
Reference in a new issue