mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add CDSI recipients refresh job
This commit is contained in:
parent
888d6bf091
commit
0840e0dedb
3 changed files with 27 additions and 9 deletions
|
@ -66,6 +66,7 @@ import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
|||
import org.asamk.signal.manager.helper.AccountFileUpdater;
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.helper.RecipientHelper.RegisteredUser;
|
||||
import org.asamk.signal.manager.jobs.RefreshRecipientsJob;
|
||||
import org.asamk.signal.manager.jobs.SyncStorageJob;
|
||||
import org.asamk.signal.manager.storage.AttachmentStore;
|
||||
import org.asamk.signal.manager.storage.AvatarStore;
|
||||
|
@ -226,14 +227,7 @@ public class ManagerImpl implements Manager {
|
|||
final var lastRecipientsRefresh = account.getLastRecipientsRefresh();
|
||||
if (lastRecipientsRefresh == null
|
||||
|| lastRecipientsRefresh < System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1)) {
|
||||
try {
|
||||
context.getRecipientHelper().refreshUsers();
|
||||
} catch (Exception e) {
|
||||
logger.warn("Full CDSI recipients refresh failed, ignoring: {} ({})",
|
||||
e.getMessage(),
|
||||
e.getClass().getSimpleName());
|
||||
logger.debug("Full CDSI refresh failed", e);
|
||||
}
|
||||
context.getJobExecutor().enqueueJob(new RefreshRecipientsJob());
|
||||
context.getAccountHelper().checkWhoAmiI();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package org.asamk.signal.manager.jobs;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RefreshRecipientsJob implements Job {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(RefreshRecipientsJob.class);
|
||||
|
||||
@Override
|
||||
public void run(Context context) {
|
||||
logger.trace("Full CDSI recipients refresh");
|
||||
try {
|
||||
context.getRecipientHelper().refreshUsers();
|
||||
} catch (Exception e) {
|
||||
logger.warn("Full CDSI recipients refresh failed, ignoring: {} ({})",
|
||||
e.getMessage(),
|
||||
e.getClass().getSimpleName());
|
||||
logger.debug("Full CDSI refresh failed", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import org.asamk.signal.manager.api.Contact;
|
|||
import org.asamk.signal.manager.api.Profile;
|
||||
import org.asamk.signal.manager.internal.JobExecutor;
|
||||
import org.asamk.signal.manager.jobs.DownloadProfileJob;
|
||||
import org.asamk.signal.manager.jobs.RefreshRecipientsJob;
|
||||
import org.asamk.signal.manager.storage.SignalAccount;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||
import org.asamk.signal.manager.util.KeyUtils;
|
||||
|
@ -152,7 +153,7 @@ public class ContactRecordProcessor extends DefaultStorageRecordProcessor<Signal
|
|||
} else if (pnisMatchButE164sDont) {
|
||||
logger.debug("Matching PNIs, but the E164s differ! Trusting our local pair.");
|
||||
}
|
||||
// TODO [pnp] Schedule CDS fetch?
|
||||
jobExecutor.enqueueJob(new RefreshRecipientsJob());
|
||||
pni = local.getPni().get();
|
||||
e164 = local.getNumber().get();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue