From 61f57dd99706349a5286539584907bf055182dd6 Mon Sep 17 00:00:00 2001 From: Karmanyaah Malhotra Date: Sun, 17 Dec 2023 17:24:18 -0600 Subject: [PATCH] put sendEndpoint on register back in --- app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt b/app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt index 9c8fe2c..1f4bbfb 100644 --- a/app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt +++ b/app/src/main/java/io/heckel/ntfy/up/BroadcastReceiver.kt @@ -93,12 +93,14 @@ class BroadcastReceiver : android.content.BroadcastReceiver() { try { // Note, this may fail due to a SQL constraint exception, see https://github.com/binwiederhier/ntfy/issues/185 repository.addSubscription(subscription) - /* We don't send the endpoint here anymore, the foreground service will do that after - registering with the push server. This avoids a race condition where the application server + distributor.sendEndpoint(appId, connectorToken, endpoint) + /* We need to stop sending the endpoint here once everyone has the new server, + the foreground service will do that after registering with the server. + That will avoid a race condition where the application server is rejected before ntfy even establishes that this topic exists. This is fine from an application perspective, because other distributors can't even register without a connection to the push server. - Unless the app sends registration twice. Then it'll get the endpoint.*/ + Unless the app registers twice. Then it'll get the endpoint anyway.*/ // Refresh (and maybe start) foreground service SubscriberServiceManager.refresh(app)