fix(web): правки применяются сразу и не сбрасывают вкладку

Вкладка «Редактирование» больше не переключается на «Сведения» при
обновлении того же фото: временное состояние панели сбрасывается только при
смене фото.

Правки теперь рендерятся без ожидания тика воркера: сервис будит воркер сразу
после постановки задачи, а уведомление о готовых вариантах приходит до
кодирования полноразмерной версии. Задержка между сохранением правок и
появлением отредактированной версии — около 0.25 с вместо нескольких секунд.
This commit is contained in:
iu
2026-10-20 23:11:57 +03:00
parent 0548b1ab5e
commit cd3d17c0f0
8 changed files with 87 additions and 27 deletions
+9
View File
@@ -44,6 +44,9 @@ type Service struct {
videoMax int64
videoEnabled bool
tempDir string
// wakeEdit будит воркер сразу после постановки правок в очередь.
wakeEdit func()
}
func NewService(store Repository, albums AlbumAccess, storage storage.Backend, hub *sse.Hub) *Service {
@@ -68,6 +71,12 @@ func (s *Service) SetUploadLimits(imageMax, videoMax int64) {
}
}
// SetEditNotifier registers a callback that is invoked when an edit render is
// queued, so the worker picks the job up without waiting for the next tick.
func (s *Service) SetEditNotifier(fn func()) {
s.wakeEdit = fn
}
// SetVideoEnabled controls whether video uploads are accepted. It is false when
// the ffmpeg/ffprobe toolchain is unavailable.
func (s *Service) SetVideoEnabled(enabled bool) { s.videoEnabled = enabled }