feat: podpora high-availability a multi-replica nasazení
- Socket.io Redis adapter pro sdílený stav přes repliky - graceful shutdown serveru - WATCH/MULTI v updateData pro race-condition-safe aktualizace - lease mechanismus pro push reminder (zabrání duplicitnímu odesílání) - k8s/ manifesty pro testovací kind cluster - Dockerfile: opraven EXPOSE port na 3001 - .gitignore: ignorovány Claude pracovní soubory
This commit is contained in:
@@ -154,6 +154,21 @@ function App() {
|
||||
}
|
||||
}, [auth?.login, socket]);
|
||||
|
||||
// Po znovupřipojení socketu znovu vstoupit do místnosti a obnovit data
|
||||
useEffect(() => {
|
||||
const onReconnect = () => {
|
||||
if (auth?.login) socket.emit('join', auth.login);
|
||||
getData({ query: { dayIndex: dayIndexRef.current } }).then(response => {
|
||||
if (response.data) {
|
||||
setData(response.data);
|
||||
setFood(response.data.menus);
|
||||
}
|
||||
});
|
||||
};
|
||||
socket.io.on('reconnect', onReconnect);
|
||||
return () => { socket.io.off('reconnect', onReconnect); };
|
||||
}, [socket, auth?.login]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!auth?.login || !data?.choices) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user