Requeue messages on the server as well

pull/569/head
Zef Hemel 2023-11-15 09:31:44 +01:00
parent 0c118f322f
commit b4ab56c712
3 changed files with 8 additions and 2 deletions

View File

@ -22,7 +22,7 @@ export async function reindexSpace() {
// Now let's wait for the processing to finish // Now let's wait for the processing to finish
let queueStats = await mq.getQueueStats("indexQueue"); let queueStats = await mq.getQueueStats("indexQueue");
while (queueStats.queued > 0 || queueStats.processing > 0) { while (queueStats.queued > 0 || queueStats.processing > 0) {
sleep(1000); await sleep(500);
queueStats = await mq.getQueueStats("indexQueue"); queueStats = await mq.getQueueStats("indexQueue");
} }
// And notify the user // And notify the user

View File

@ -68,6 +68,11 @@ export class ServerSystem {
const mq = new DataStoreMQ(this.ds); const mq = new DataStoreMQ(this.ds);
setInterval(() => {
// Timeout after 5s, retries 3 times, otherwise drops the message (no DLQ)
mq.requeueTimeouts(5000, 3, true).catch(console.error);
}, 20000); // Look to requeue every 20s
const plugNamespaceHook = new PlugNamespaceHook(); const plugNamespaceHook = new PlugNamespaceHook();
this.system.addHook(plugNamespaceHook); this.system.addHook(plugNamespaceHook);
@ -154,6 +159,7 @@ export class ServerSystem {
"reindexSpace", "reindexSpace",
[], [],
).then(() => { ).then(() => {
console.log("Initial index completed!");
this.ds.set(["$initialIndexDone"], true); this.ds.set(["$initialIndexDone"], true);
}).catch(console.error); }).catch(console.error);
if (awaitIndex) { if (awaitIndex) {

View File

@ -100,7 +100,7 @@ function loadJsByUrl(url) {
} }
</script> </script>
<!-- Load SB's own CSS here too --> <!-- Load SB's own CSS here too -->
<link rel="stylesheet" href="/.client/main.css" /> <link rel="stylesheet" href="/.client/main.css">
<style> <style>
html, html,
body { body {