Skip to content

fix: do not overwrite settings when updating channel in task#1045

Merged
Zibbp merged 1 commit intomainfrom
channel-update-fix
Jan 31, 2026
Merged

fix: do not overwrite settings when updating channel in task#1045
Zibbp merged 1 commit intomainfrom
channel-update-fix

Conversation

@Zibbp
Copy link
Owner

@Zibbp Zibbp commented Jan 31, 2026

Fixes #1038

@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

Walkthrough

Refactored channel update logic in the periodic task handler from directly calling channelService.UpdateChannel to using a builder-style pattern with c.Update(), SetExtID(), SetName(), SetDisplayName(), SetImagePath(), and Save(ctx). Updated error messaging for clarity. The updated channel object replaces the in-memory reference after successful persistence.

Changes

Cohort / File(s) Summary
Periodic Task Channel Update Refactoring
internal/tasks/periodic/periodic.go
Replaced service-based channel update with builder pattern using Update() and setter methods (SetExtID, SetName, SetDisplayName, SetImagePath) followed by Save(ctx). The result is assigned back to the channel variable. Error message clarified to specify database update failure. Subsequent image update operations now execute on the updated channel object.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: preventing settings overwrite during channel updates in periodic tasks.
Description check ✅ Passed The description references the linked issue #1038 which directly relates to the changeset addressing retention period loss.
Linked Issues check ✅ Passed The code changes implement a builder-style update using SetExtID, SetName, SetDisplayName, and SetImagePath, avoiding overwriting unmodified fields that was likely causing retention settings loss.
Out of Scope Changes check ✅ Passed All changes in periodic.go are focused on fixing the channel update mechanism to preserve retention settings, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch channel-update-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Zibbp Zibbp merged commit b7fc815 into main Jan 31, 2026
8 checks passed
@Zibbp Zibbp deleted the channel-update-fix branch January 31, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

retention period has been reset?

1 participant