diff --git a/lib/data/imap/imap_client_factory.dart b/lib/data/imap/imap_client_factory.dart index 1eda98f..9a24a85 100644 --- a/lib/data/imap/imap_client_factory.dart +++ b/lib/data/imap/imap_client_factory.dart @@ -21,7 +21,8 @@ Future connectImap( 'Unencrypted IMAP connections are not allowed. Enable SSL/TLS.', ); } - final client = ImapClient(); + final client = + ImapClient(defaultResponseTimeout: const Duration(seconds: 20)); await client.connectToServer(account.imapHost, account.imapPort); await client.login(username, password); return client; diff --git a/lib/data/jmap/jmap_client.dart b/lib/data/jmap/jmap_client.dart index 9e93013..5a62884 100644 --- a/lib/data/jmap/jmap_client.dart +++ b/lib/data/jmap/jmap_client.dart @@ -123,7 +123,7 @@ class JmapClient { }, body: body, ) - .timeout(const Duration(seconds: 30)); + .timeout(const Duration(seconds: 10)); if (resp.statusCode != 200) { throw JmapException('API call failed (HTTP ${resp.statusCode})'); @@ -160,7 +160,7 @@ class JmapClient { }, body: data, ) - .timeout(const Duration(seconds: 30)); + .timeout(const Duration(seconds: 10)); if (resp.statusCode != 200 && resp.statusCode != 201) { throw JmapException('Blob upload failed (HTTP ${resp.statusCode})'); } diff --git a/stalwart-dev/test.sh b/stalwart-dev/test.sh index f53388a..4690f82 100755 --- a/stalwart-dev/test.sh +++ b/stalwart-dev/test.sh @@ -62,6 +62,6 @@ export STALWART_IMAP_HOST="127.0.0.1" export STALWART_SMTP_HOST="127.0.0.1" START=$(date +%s) -fvm flutter test test/integration/ +fvm flutter test --concurrency=1 test/integration/ END=$(date +%s) echo "integration: $((END - START))s" diff --git a/test/integration/concurrent_sync_test.dart b/test/integration/concurrent_sync_test.dart index 96558ee..0c1366d 100644 --- a/test/integration/concurrent_sync_test.dart +++ b/test/integration/concurrent_sync_test.dart @@ -61,7 +61,9 @@ Future _connectImapPlaintext( String username, String password, ) async { - final client = enough_mail.ImapClient(); + final client = enough_mail.ImapClient( + defaultResponseTimeout: const Duration(seconds: 20), + ); await client.connectToServer( account.imapHost, account.imapPort, @@ -125,7 +127,7 @@ void main() { }); test('concurrent IMAP + JMAP sync caches all emails without errors', - timeout: const Timeout(Duration(minutes: 2)), () async { + timeout: const Timeout(Duration(seconds: 30)), () async { final ts = DateTime.now().millisecondsSinceEpoch; const msgCount = 2; diff --git a/test/integration/email_repository_imap_test.dart b/test/integration/email_repository_imap_test.dart index c03fbf0..6ac2422 100644 --- a/test/integration/email_repository_imap_test.dart +++ b/test/integration/email_repository_imap_test.dart @@ -27,7 +27,8 @@ Future _imapConnect({ required String user, required String pass, }) async { - final client = ImapClient(); + final client = + ImapClient(defaultResponseTimeout: const Duration(seconds: 20)); await client.connectToServer(host, port, isSecure: false); await client.login(user, pass); return client; @@ -109,7 +110,8 @@ void main() { String username, String password, ) async { - final client = ImapClient(); + final client = + ImapClient(defaultResponseTimeout: const Duration(seconds: 20)); await client.connectToServer(a.imapHost, a.imapPort, isSecure: false); await client.login(username, password); return client;