autoresearch iter 20: give the telegram poller a real long-poll window

telebot types LongPoller.Timeout as time.Duration and sends
int(timeout / time.Second) to getUpdates, so the literal 10 meant ten
nanoseconds: Telegram received timeout=0, long polling never held the
connection, and the adapter polled the Bot API in a tight loop instead.
Use 10 seconds and extract the settings so the conversion is asserted.

The adapter also has no media temp-dir cleanup (downloadMedia creates an
MkdirTemp per attachment and nothing removes it); that is left as a separate
change rather than bundled here.
This commit is contained in:
ryan
2026-08-29 09:32:27 +08:00
parent ae8bbd98f8
commit efa75558af
3 changed files with 60 additions and 7 deletions
@@ -1578,14 +1578,33 @@ func TestAppPrepareResolvesAndGatesPlugins(t *testing.T) {
cacheFiber, ok := app.Fiber("cache")
require.True(t, ok)
require.Equal(t, core.FiberPending, cacheFiber.State(), "Prepare only builds the resolution barrier")
assert.True(t, app.Context().Config().Resolved())
require.NoError(t, app.Reconcile())
require.Equal(t, core.FiberActive, cacheFiber.State())
memoryFiber, ok := app.Fiber("cache_memory")
require.True(t, ok)
require.Equal(t, core.FiberSkipped, memoryFiber.State())
assert.Equal(t, core.FiberSkipped, memoryFiber.State())
assert.False(t, redisAlt.applied)
}
func TestAppGatesPluginsMountedAfterPrepare(t *testing.T) {
app := core.NewApp(core.WithConfigSource(newGateSource(true)))
require.NoError(t, app.Prepare())
late := &gatedPlugin{name: "cache_memory", enabled: false}
app.Use(late)
require.NoError(t, app.Reconcile())
fiber, ok := app.Fiber("cache_memory")
require.True(t, ok)
assert.Equal(t, core.FiberSkipped, fiber.State(),
"plugins added after Prepare must still be gated")
}
func TestAppApplyPluginsGatesImplicitly(t *testing.T) {
redisLike := &gatedPlugin{name: "cache", enabled: true}
app := core.NewApp(core.WithConfigSource(newGateSource(false)))