Skip to content

Commit 4cfcce7

Browse files
committed
Simplify lifecycle status updates
1 parent 4e7fb11 commit 4cfcce7

4 files changed

Lines changed: 6 additions & 52 deletions

File tree

constants/consts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import "time"
44

55
const (
66
ProgName = "ChatWire"
7-
Version = "2704-04.20.2026-0108a" // build-mm.dd.yyyy-hhmmsuffix
7+
Version = "2705-04.21.2026-1305a" // build-mm.dd.yyyy-hhmmsuffix
88
CWEpoch = 1653239822390688174 //Never change this
99
SeenDivisor = 60
1010
SeenEpoch = 1546326000

fact/operation_status.go

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
const (
1818
operationAnnounceDelay = 3 * time.Second
1919
operationProgressThrottle = 10 * time.Second
20-
operationReminderInterval = 10 * time.Second
2120
operationOptionalTTL = 60 * time.Second
2221
)
2322

@@ -131,13 +130,9 @@ func UpdateOperationProgressDelayed(token, title, description string, color int,
131130
func UpdateOperationProgressDelayedWithReminder(token, title, description, reminderDescription string, color int, delay time.Duration) {
132131
title = strings.TrimSpace(title)
133132
description = strings.TrimSpace(description)
134-
reminderDescription = strings.TrimSpace(reminderDescription)
135133
if token == "" || title == "" || description == "" {
136134
return
137135
}
138-
if reminderDescription == "" {
139-
reminderDescription = description
140-
}
141136
if delay <= 0 {
142137
UpdateOperationProgress(token, title, description, color)
143138
return
@@ -153,18 +148,10 @@ func UpdateOperationProgressDelayedWithReminder(token, title, description, remin
153148
delayID := operationStatus.pendingDelayID
154149
operationStatusLock.Unlock()
155150

156-
go func(tok, ttl, firstDesc, repeatDesc string, firstWait time.Duration, id uint64) {
157-
wait := firstWait
158-
desc := firstDesc
159-
for {
160-
time.Sleep(wait)
161-
if !emitScheduledOperationProgress(tok, ttl, desc, color, id) {
162-
return
163-
}
164-
desc = repeatDesc
165-
wait = operationReminderInterval
166-
}
167-
}(token, title, description, reminderDescription, firstWait, delayID)
151+
go func(tok, ttl, firstDesc string, firstWait time.Duration, id uint64) {
152+
time.Sleep(firstWait)
153+
_ = emitScheduledOperationProgress(tok, ttl, firstDesc, color, id)
154+
}(token, title, description, firstWait, delayID)
168155
}
169156

170157
func nextOptionalProgressDelay(startedAt time.Time, announced bool, delay time.Duration) time.Duration {

fact/operation_status_test.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -75,39 +75,6 @@ func TestNewDelayedProgressReplacesOlderPendingReminder(t *testing.T) {
7575
}
7676
}
7777

78-
func TestDelayedReminderUsesRepeatWordingAfterFirstEmission(t *testing.T) {
79-
resetOperationStatusTestState()
80-
81-
token := BeginOperation("Starting Factorio.", "Starting Factorio.")
82-
UpdateOperationProgressDelayedWithReminder(token, "Starting Factorio.", "Factorio is loading mods.", "Factorio is continuing to load mods.", 0, time.Hour)
83-
84-
operationStatusLock.Lock()
85-
delayID := operationStatus.pendingDelayID
86-
operationStatusLock.Unlock()
87-
88-
if !emitScheduledOperationProgress(token, "Starting Factorio.", "Factorio is loading mods.", 0, delayID) {
89-
t.Fatal("expected first delayed reminder to be accepted")
90-
}
91-
92-
operationStatusLock.Lock()
93-
if operationStatus.description != "Factorio is loading mods." {
94-
operationStatusLock.Unlock()
95-
t.Fatalf("expected first emission to use initial wording, got %q", operationStatus.description)
96-
}
97-
operationStatus.lastProgressUpdateAt = time.Now().Add(-operationProgressThrottle - time.Millisecond)
98-
operationStatusLock.Unlock()
99-
100-
if !emitScheduledOperationProgress(token, "Starting Factorio.", "Factorio is continuing to load mods.", 0, delayID) {
101-
t.Fatal("expected repeat delayed reminder to be accepted")
102-
}
103-
104-
operationStatusLock.Lock()
105-
defer operationStatusLock.Unlock()
106-
if operationStatus.description != "Factorio is continuing to load mods." {
107-
t.Fatalf("expected repeat emission to use reminder wording, got %q", operationStatus.description)
108-
}
109-
}
110-
11178
func TestFinalizeOperationRejectsOlderPendingReminders(t *testing.T) {
11279
resetOperationStatusTestState()
11380

fact/status_messages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,5 @@ func StatusBringingServerOnline() string {
9393
}
9494

9595
func StatusBringingServerOnlineStill() string {
96-
return "Factorio is still bringing the server online."
96+
return StatusBringingServerOnline()
9797
}

0 commit comments

Comments
 (0)