make sure to poll quicker if we get >95 messages on one polling
This commit is contained in:
parent
ae8688bf2a
commit
760b99587a
|
@ -232,12 +232,19 @@ export class SwarmPolling {
|
|||
window?.log?.info(
|
||||
`Polled for group(${ed25519Str(pubkey.key)}):, got ${messages.length} messages back.`
|
||||
);
|
||||
let lastPolledTimestamp = Date.now();
|
||||
if (messages.length >= 95) {
|
||||
// if we get 95 messages or more back, it means there are probably more than this
|
||||
// so make sure to retry the polling in the next 5sec by marking the last polled timestamp way before that it is really
|
||||
// this is a kind of hack
|
||||
lastPolledTimestamp = Date.now() - SWARM_POLLING_TIMEOUT.INACTIVE - 5 * 1000;
|
||||
}
|
||||
// update the last fetched timestamp
|
||||
this.groupPolling = this.groupPolling.map(group => {
|
||||
if (PubKey.isEqual(pubkey, group.pubkey)) {
|
||||
return {
|
||||
...group,
|
||||
lastPolledTimestamp: Date.now(),
|
||||
lastPolledTimestamp,
|
||||
};
|
||||
}
|
||||
return group;
|
||||
|
|
Loading…
Reference in New Issue