diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-27 21:12:05 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-27 21:12:05 -0300 |
| commit | 97b49ae7081b989274b313532ff17c71694097a9 (patch) | |
| tree | 6595e0d5a39d04971a71e886bc3f8cc589741f5d /internal/app | |
| parent | 83ce95cf10fd9e9d581362453c558239d37ae06e (diff) | |
| download | telegram-main.tar.gz | |
cep.is/go v0.2.0 exposes the municipality as Error.Faixa, which is what
internal/lookup existed to work around: v0.1.0 discarded the 404 body, so
the bot re-issued the request just to read the block back.
The extra GET on the 404 path is gone, and with it the second timeout,
the body size cap and the "is it still a 404?" check that guarded it.
The replies are byte for byte what they were -- the formatting tests did
not change a single assertion, only the type they build.
Diffstat (limited to 'internal/app')
| -rw-r--r-- | internal/app/app.go | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/internal/app/app.go b/internal/app/app.go index ccb8483..3d58dca 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -15,7 +15,6 @@ import ( "cep.is/telegrambot/internal/bot" "cep.is/telegrambot/internal/config" - "cep.is/telegrambot/internal/lookup" "cep.is/telegrambot/internal/telegram" ) @@ -35,11 +34,6 @@ type App struct { // The whole-call timeout of the cep.is client is the shutdown grace on purpose: // handling one update is what a termination signal waits for, so a lookup must // not be allowed to outlast that budget. -// -// The client goes to the bot wrapped in [lookup.Client], which is what keeps the -// municipality the API names on a 404. The wrapper has its own short timeout, -// deliberately far below the grace: it is a footnote on an answer that is -// already writable. func New(ctx context.Context, cfg config.Config, logger *slog.Logger) (*App, error) { if logger == nil { logger = slog.Default() @@ -56,7 +50,6 @@ func New(ctx context.Context, cfg config.Config, logger *slog.Logger) (*App, err if err != nil { return nil, fmt.Errorf("app: cep.is client: %w", err) } - lookups := lookup.New(cepisClient) api, err := telegram.New(cfg.Token, telegram.WithBaseURL(cfg.TelegramAPIBaseURL), @@ -76,7 +69,7 @@ func New(ctx context.Context, cfg config.Config, logger *slog.Logger) (*App, err return nil, fmt.Errorf("app: getMe returned no username") } - handler := bot.New(lookups, api, me.Username, bot.WithLogger(logger)) + handler := bot.New(cepisClient, api, me.Username, bot.WithLogger(logger)) poller := telegram.NewPoller(api, handler, telegram.WithLogger(logger), telegram.WithPollTimeout(cfg.PollTimeout), |