Skip to content

v1.8.2 — Hotfix app context + Telegram 400

Choose a tag to compare

@Gonzalez8 Gonzalez8 released this 22 May 17:20
· 43 commits to main since this release

Hotfix on top of v1.8.1

Production logs revealed two bugs after deploying v1.8.1.

1. RuntimeError: Working outside of application context

TelegramHumanSolver.solve() calls PendingCaptcha.create() which
hits db.session.add(). Flask-SQLAlchemy needs an active app context
for that to resolve. The scheduler's perform_check_for_user only
opened the context inside helpers like is_working_day (which closes
when the helper returns), so by the time CheckJCClient.login() ran,
no context was active.

Wrapped the entire try/except block (including the with CheckJCClient(...) lifetime and the post-fichaje Telegram
notification) in a single with app.app_context(). The captcha solver
and its DB polling now run inside that context.

2. Telegram 400 Bad Request on error notifications

The error notification message produced by _format_error_for_telegram
contained ".com" and other punctuation that Telegram's Markdown parser
rejects with 400. Switched the error notification path to
parse_mode=None (plain text). Also made TelegramClient.send_message
tolerate parse_mode=None by dropping the key from the payload.

Image

ghcr.io/gonzalez8/checktime:1.8.2 / :1.8 / :latest

Upgrade

sed -i 's/^CHECK_TIME_VERSION=.*/CHECK_TIME_VERSION=1.8.2/' stack.env
docker compose pull app
docker compose up -d app

No schema changes, no new env vars.