feat: implement backlog sync cooldown mechanism and update related tests

This commit is contained in:
MythEclipse
2026-05-15 18:38:17 +07:00
parent a97feb1e2a
commit 61b07e4b01
3 changed files with 87 additions and 7 deletions
+6 -6
View File
@@ -125,13 +125,13 @@
el.channelSelect.value = state.selectedVoiceChannel;
el.channelFilter.value = state.selectedTextChannel;
applyActiveTab(state.activeTab);
if ((textChanged || textGuildChanged) && state.selectedTextChannel && state.selectedTextGuild) {
await apiRequest('/api/backlog-sync', {
method: 'POST',
body: JSON.stringify({ guildId: state.selectedTextGuild, channelId: state.selectedTextChannel }),
}).catch((error) => showError(`Backlog sync failed: ${error.message}`));
}
if (textChanged || textGuildChanged || state.activeTab === 'text') {
if (state.selectedTextChannel && state.selectedTextGuild) {
await apiRequest('/api/backlog-sync', {
method: 'POST',
body: JSON.stringify({ guildId: state.selectedTextGuild, channelId: state.selectedTextChannel }),
}).catch((error) => showError(`Backlog sync failed: ${error.message}`));
}
await fetchText().catch((error) => showError(error.message));
}
await reconcileListenState();