this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(bot): handle Bun hot reload gracefully to prevent 409 conflict

Use import.meta.hot.dispose() to stop the Telegram bot polling before
module replacement during hot reload. This prevents the "terminated by
other getUpdates request" error when developing with `bun --hot`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

alice be435a16 f6c0481b

+18
+9
src/bot.ts
··· 378 378 throw error; 379 379 } 380 380 } 381 + 382 + // Handle Bun hot reload - stop bot before module replacement 383 + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, @typescript-eslint/strict-boolean-expressions -- import.meta.hot is undefined when not in hot mode 384 + if (import.meta.hot) { 385 + import.meta.hot.dispose(() => { 386 + console.log('Hot reload: stopping bot...'); 387 + bot.stop('HOT_RELOAD'); 388 + }); 389 + }
+9
src/index.ts
··· 160 160 console.error('Fatal error starting server:', error); 161 161 process.exit(1); 162 162 }); 163 + 164 + // Handle Bun hot reload - cleanup before module replacement 165 + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, @typescript-eslint/strict-boolean-expressions -- import.meta.hot is undefined when not in hot mode 166 + if (import.meta.hot) { 167 + import.meta.hot.dispose(() => { 168 + console.log('Hot reload: cleaning up main module...'); 169 + // Bot cleanup is handled in bot.ts 170 + }); 171 + }