Merge branch 'krille/fix-sync-error' into 'main'
fix: Dont catch sync errors See merge request famedly/famedlysdk!656
This commit is contained in:
commit
b6b6231ca5
|
|
@ -951,15 +951,19 @@ class Client extends MatrixApi {
|
||||||
_retryDelay = Future.delayed(Duration(seconds: syncErrorTimeoutSec));
|
_retryDelay = Future.delayed(Duration(seconds: syncErrorTimeoutSec));
|
||||||
if (!isLogged() || _disposed || _aborted) return null;
|
if (!isLogged() || _disposed || _aborted) return null;
|
||||||
try {
|
try {
|
||||||
|
var syncError;
|
||||||
final syncRequest = sync(
|
final syncRequest = sync(
|
||||||
filter: syncFilters,
|
filter: syncFilters,
|
||||||
since: prevBatch,
|
since: prevBatch,
|
||||||
timeout: prevBatch != null ? 30000 : null,
|
timeout: prevBatch != null ? 30000 : null,
|
||||||
setPresence: syncPresence,
|
setPresence: syncPresence,
|
||||||
);
|
).catchError((e) => syncError = e);
|
||||||
_currentSyncId = syncRequest.hashCode;
|
_currentSyncId = syncRequest.hashCode;
|
||||||
final syncResp = await syncRequest;
|
final syncResp = await syncRequest;
|
||||||
|
if (syncError != null) throw syncError;
|
||||||
if (_currentSyncId != syncRequest.hashCode) {
|
if (_currentSyncId != syncRequest.hashCode) {
|
||||||
|
Logs()
|
||||||
|
.w('Current sync request ID has changed. Dropping this sync loop!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (database != null) {
|
if (database != null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue