diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/api/Api.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/api/Api.kt index 7e0cf3f..c953c08 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/api/Api.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/api/Api.kt @@ -95,12 +95,12 @@ class Api(context: Context) { .get() .build() - syncSource.set( + syncSource.getAndSet( EventSources.createFactory(client).newEventSource( request, SSEListener(context) ) - ) + )?.cancel() Log.d(TAG, "cSync done.") } }