mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 17:28:07 +01:00
Publish "messages persisted" events when unlocking queues after a persistence run
This commit is contained in:
committed by
Jon Chambers
parent
084607f359
commit
562b495a18
@@ -58,11 +58,6 @@ public class PubSubClientEventManager extends RedisClusterPubSubAdapter<byte[],
|
||||
.build()
|
||||
.toByteArray();
|
||||
|
||||
private final byte[] MESSAGES_PERSISTED_EVENT_BYTES = ClientEvent.newBuilder()
|
||||
.setMessagesPersisted(MessagesPersistedEvent.getDefaultInstance())
|
||||
.build()
|
||||
.toByteArray();
|
||||
|
||||
@Nullable
|
||||
private FaultTolerantPubSubClusterConnection<byte[], byte[]> pubSubConnection;
|
||||
|
||||
@@ -224,25 +219,6 @@ public class PubSubClientEventManager extends RedisClusterPubSubAdapter<byte[],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Publishes an event notifying a specific device that messages have been persisted from short-term to long-term
|
||||
* storage.
|
||||
*
|
||||
* @param accountIdentifier the account identifier for which messages have been persisted
|
||||
* @param deviceId the ID of the device within the target account
|
||||
*
|
||||
* @return a future that completes when the event has been published
|
||||
*/
|
||||
public CompletionStage<Void> handleMessagesPersisted(final UUID accountIdentifier, final byte deviceId) {
|
||||
if (pubSubConnection == null) {
|
||||
throw new IllegalStateException("Presence manager not started");
|
||||
}
|
||||
|
||||
return pubSubConnection.withPubSubConnection(connection ->
|
||||
connection.async().spublish(getClientEventChannel(accountIdentifier, deviceId), MESSAGES_PERSISTED_EVENT_BYTES))
|
||||
.thenRun(Util.NOOP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether a client with the given account/device is connected to this presence manager instance.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user