fix(update): stamp install type and bound retry backoff

This commit is contained in:
sam committed 2026-08-16 23:59:48 +10:00
1 parent 5080be3450
commit 2b5c67087b
3 files changed
+25 -2

No files matched your search

+3 -1
View File
@@ -168,7 +168,9 @@ echo "==> Building archied and archie-agent..."
# refuses to self-update (internal/releaseupdate.ErrUnknownInstallType)
# rather than guess whether /update's configured install command is
# even the right kind of update for a script-built native binary.
go build -ldflags "-X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o "${ARCHIE_BIN_DIR}/archied" ./cmd/archied
GATEWAY_VERSION="$(git describe --tags --match 'archied/v*' 2>/dev/null | sed 's|^archied/v||' || echo dev)"
RUNTIME_VERSION="$(git describe --tags --match 'archie/v*' 2>/dev/null | sed 's|^archie/v||' || echo dev)"
go build -ldflags "-X main.gatewayVersion=${GATEWAY_VERSION} -X main.runtimeVersion=${RUNTIME_VERSION} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o "${ARCHIE_BIN_DIR}/archied" ./cmd/archied
go build -o "${ARCHIE_BIN_DIR}/archie-agent" ./cmd/archie-agent
)
echo " Installed binaries to ${ARCHIE_BIN_DIR}/"
+5 -1
View File
@@ -1096,10 +1096,14 @@ func (d *Daemon) requestTaskRun(ctx context.Context, taskID int64, data []byte)
if !errors.Is(err, eventbus.ErrNoResponders) || !time.Now().Before(deadline) {
return nil, err
}
wait := min(backoff, time.Until(deadline))
if wait <= 0 {
return nil, err
}
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(backoff):
case <-time.After(wait):
}
}
}
+17
View File
@@ -390,6 +390,22 @@ func daemonWithNATS(t *testing.T) (*Daemon, *store.Store, *arnats.Client) {
return d, s, client
}
func TestRequestTaskRunDoesNotSleepPastReadyDeadline(t *testing.T) {
d, _, _ := daemonWithNATS(t)
d.TaskRunReadyTimeout = 10 * time.Millisecond
d.TaskRunRetryBackoff = time.Second
start := time.Now()
_, err := d.requestTaskRun(context.Background(), 1, nil)
elapsed := time.Since(start)
if err == nil {
t.Fatal("requestTaskRun() error = nil, want no responders")
}
if elapsed >= 200*time.Millisecond {
t.Fatalf("requestTaskRun() took %s, want it to stop at the ready deadline", elapsed)
}
}
func TestRunViaAgentParksOnRequestFailure(t *testing.T) {
d, s, _ := daemonWithNATS(t)
// Bound the no-responders retry window tightly so this test proves
@@ -1066,6 +1082,7 @@ func (f *recordingForge) CreateIssue(context.Context, string, string, string, st
func (f *recordingForge) React(context.Context, string, string, int, string) error {
panic("unexpected call")
}
func (f *recordingForge) VerifyPush(context.Context, string, string) error { panic("unexpected call") }
func (f *recordingForge) LinkBranch(context.Context, string, string, int, string) error {
panic("unexpected call")