Skip to content

Исправление задержки кнопки «Пропустить» при длительном воспроизведении#12

Open
ndrco wants to merge 1 commit into
masterfrom
codex/fix-auto_play_show_skip_window-on-long-texts
Open

Исправление задержки кнопки «Пропустить» при длительном воспроизведении#12
ndrco wants to merge 1 commit into
masterfrom
codex/fix-auto_play_show_skip_window-on-long-texts

Conversation

@ndrco

@ndrco ndrco commented Feb 22, 2026

Copy link
Copy Markdown
Owner

Motivation

  • При включённом AUTO_PLAY_SHOW_SKIP_WINDOW кнопка «Пропустить» становилась неактивной, но воспроизведение через ffplay продолжало идти до конца длинного текста и сообщение [player] Playback skipped появлялось только по завершении трека, что делало поведение пропуска недетерминированным.

Description

  • В AudioPlayer.skip() добавлен немедленный вызов terminate() у текущего процесса ffplay сразу после установки флага _skip_event, чтобы гарантировать немедленную остановку воспроизведения; изменение внесено в app/audio/player.py.

Testing

  • Запуск целевых тестов pytest -q tests/test_api_tts.py::test_skip_playback tests/test_api_tts.py::test_skip_playback_with_auth был выполнен, но завершился с ошибкой загрузки тестовой среды из-за отсутствия зависимости httpx, поэтому автоматические тесты не прошли в этом окружении.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 087792f68d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/audio/player.py
with self._lock:
if self._current_proc is not None and self._current_proc.poll() is None:
self._skip_event.set()
self._current_proc.terminate()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Clear stale skip event after force-terminating playback

Calling terminate() inside skip() can make the worker loop exit before it reaches the branch that clears _skip_event (if self._skip_event.is_set(): ... clear()), leaving the flag set for the next track. In that case, the next playback is immediately terminated as soon as _play_blocking() starts, even though no new skip was requested. This regression is triggered when skip() is invoked during active playback and the process exits before the worker re-enters the loop body.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant