mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
Clean old prekeys only after server message queue is empty
This commit is contained in:
parent
d1e32f2b11
commit
080c14d111
3 changed files with 26 additions and 1 deletions
|
@ -118,8 +118,15 @@ public class PreKeyHelper {
|
|||
logger.warn("Failed to updated pre keys: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanSignedPreKeys((serviceIdType));
|
||||
public void cleanOldPreKeys() {
|
||||
cleanOldPreKeys(ServiceIdType.ACI);
|
||||
cleanOldPreKeys(ServiceIdType.PNI);
|
||||
}
|
||||
|
||||
private void cleanOldPreKeys(final ServiceIdType serviceIdType) {
|
||||
cleanSignedPreKeys(serviceIdType);
|
||||
cleanOneTimePreKeys(serviceIdType);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.asamk.signal.manager.actions.HandleAction;
|
|||
import org.asamk.signal.manager.api.ReceiveConfig;
|
||||
import org.asamk.signal.manager.api.UntrustedIdentityException;
|
||||
import org.asamk.signal.manager.internal.SignalDependencies;
|
||||
import org.asamk.signal.manager.jobs.CleanOldPreKeysJob;
|
||||
import org.asamk.signal.manager.storage.SignalAccount;
|
||||
import org.asamk.signal.manager.storage.messageCache.CachedMessage;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||
|
@ -176,6 +177,7 @@ public class ReceiveHelper {
|
|||
handleQueuedActions(queuedActions.keySet());
|
||||
queuedActions.clear();
|
||||
|
||||
context.getJobExecutor().enqueueJob(new CleanOldPreKeysJob());
|
||||
hasCaughtUpWithOldMessages = true;
|
||||
caughtUpWithOldMessagesListener.call();
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package org.asamk.signal.manager.jobs;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CleanOldPreKeysJob implements Job {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CleanOldPreKeysJob.class);
|
||||
|
||||
@Override
|
||||
public void run(Context context) {
|
||||
logger.trace("Cleaning old prekeys");
|
||||
context.getPreKeyHelper().cleanOldPreKeys();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue