mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 08:52:42 +00:00
Coop: shorten first-day window — require 12h since lock, not date change
Previous guard skipped resolution if lock_date == today_date, pushing first-day windows to 24-32h regardless of when in the UTC day the lock fired. With per-minute lock checks, the original same-tick race no longer exists, so the date guard was just adding latency. New guard: at least 12h since lock. Late-night locks still get >12h funding/voting windows; early-morning locks get 24h+ as before. No effect on the existing run #1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -148,11 +148,15 @@ func (p *AdventurePlugin) coopProcessActiveRuns() {
|
|||||||
slog.Error("coop: load active runs", "err", err)
|
slog.Error("coop: load active runs", "err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
today := time.Now().UTC().Format("2006-01-02")
|
now := time.Now().UTC()
|
||||||
for _, run := range runs {
|
for _, run := range runs {
|
||||||
// Skip runs locked on this same tick — they need a full day for
|
// Need at least a 12h funding window between lock and the first
|
||||||
// funding decisions and voting before the first floor resolves.
|
// floor resolution. Without this, a run locked at 07:00 UTC would
|
||||||
if run.LockedAt != nil && run.LockedAt.UTC().Format("2006-01-02") == today {
|
// resolve an hour later at 08:00 UTC. With per-minute lock checks
|
||||||
|
// (locks now fire any time), the previous "same UTC date" guard
|
||||||
|
// was too conservative — it pushed first-day windows out to 24-32h
|
||||||
|
// even when 13-23h would have been plenty.
|
||||||
|
if run.LockedAt != nil && now.Sub(run.LockedAt.UTC()) < 12*time.Hour {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := p.coopResolveFloor(run); err != nil {
|
if err := p.coopResolveFloor(run); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user