Skip to content

🔧 feat: Add contract state-based save frequency and menu visibility#1972

Merged
mkmccarty merged 3 commits intomainfrom
mm-branch-1
Dec 23, 2025
Merged

🔧 feat: Add contract state-based save frequency and menu visibility#1972
mkmccarty merged 3 commits intomainfrom
mm-branch-1

Conversation

@mkmccarty
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 23, 2025 00:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements contract state-based save frequency throttling and conditionally hides the boost menu during the signup phase. The changes aim to reduce unnecessary database writes during different contract lifecycle stages.

Key Changes:

  • Adds time-based save throttling with different intervals for signup (2 minutes) vs. active contracts (15 seconds)
  • Hides the boost menu UI component when contracts are in the signup state
  • Imports the time package to support the new throttling logic

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/boost/boost_datastore.go Implements save frequency throttling based on contract state and last save time
src/boost/boost_button_reactions.go Conditionally renders the boost menu only for non-signup contracts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +77 to +87
if contract.State == ContractStateSignup {
if time.Since(contract.LastSaveTime) < 2*time.Minute && contract.CoopSize < len(contract.Boosters) {
// Only save signup contracts every 2 minutes during signup
return
}
} else {
if time.Since(contract.LastSaveTime) < 15*time.Second {
// Only save non-signup contracts every 15 seconds during signup
return
}
}
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

The LastSaveTime field is checked to throttle saves, but it's never updated after a successful save. This means the throttling logic will never work correctly - the first save will work, but subsequent saves will always be skipped because LastSaveTime will remain at its zero value or the last value it was set to. You need to update contract.LastSaveTime = time.Now() after calling saveSqliteData(contract) on line 89.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Comment thread src/boost/boost_datastore.go Outdated
Comment thread src/boost/boost_datastore.go Outdated
mkmccarty and others added 2 commits December 22, 2025 16:11
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 23, 2025

@mkmccarty I've opened a new pull request, #1973, to work on those changes. Once the pull request is ready, I'll request review from you.

@mkmccarty mkmccarty merged commit 7f2d89f into main Dec 23, 2025
15 checks passed
@mkmccarty mkmccarty deleted the mm-branch-1 branch December 23, 2025 00:18
mkmccarty added a commit that referenced this pull request Dec 23, 2025
[WIP] WIP Address feedback from PR #1972 on contract state-based features
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.

3 participants