Skip to content

fix(server): log SetPerm permission refresh duration (RIG-11816) - #188

Closed
rigel-mintaka wants to merge 1 commit into
rigel-releasefrom
ci-pipelines/rig-11816-log-setperm-permission-refresh-duration
Closed

rigel-mintaka wants to merge 1 commit into
rigel-releasefrom
ci-pipelines/rig-11816-log-setperm-permission-refresh-duration

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Nov 21, 2026 •

Copy link
Copy Markdown

Summary

RIG-11816 reports /config requests stalling 31 to 100 s. One suspect is the forge permission refresh in SetPerm (server/router/middleware/session/repo.go). It calls _forge.Repo with no timeout when the stored permission is over an hour old.

This PR only adds logging. It does not prove or refute the cause by itself. The logs will show it after deploy.

  • INFO SetPerm refresh on every refresh attempt, with duration, synced_age, repo, user, and err.
  • WARN SetPerm refresh slow when the refresh takes longer than 5 s.

No control-flow, timeout, or error-handling change.

Verification

Run on macpro2013 with -tags test (the Makefile passes it):

  • go build ./server/... OK
  • go vet -tags test ./server/router/middleware/session/ OK
  • go test -tags test -count=1 ./server/router/middleware/session/... ok ... session 0.103s, TestSetPerm passes
  • gofmt -l clean

After deploy

Query Loki for slow refreshes:

{service_name="woodpecker-server"} |= "SetPerm refresh"

A duration near 31 to 100 s on the /config path confirms the hypothesis. Short durations refute it.

Spec impact

None.

Risks

Log volume: one INFO line per stale-permission refresh (at most one per user and repo per hour).

Refs RIG-11816

Co-authored-by: Matt Wilkinson matt@rigel.build

Log the forge permission refresh in SetPerm at INFO with its duration,
the age of the stored permission, the repo, the user and any error.
Log at WARN when the refresh takes longer than 5s. No behavior change.

Refs RIG-11816

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Nov 21, 2026

Copy link
Copy Markdown

RIG-11816

@rigel-mintaka

Copy link
Copy Markdown
Author

All-clear at 1a2d3c3
Base: rigel-release

@rigel-mintaka

Copy link
Copy Markdown
Author

Ported as RigelBuild/nebula#224 (forks/woodpecker). Closing this PR. The fork's release minter goes away in orion#8810, so fixes ship from nebula now.

Refs RIG-11816.

rigel-nemo Bot pushed a commit to RigelBuild/nebula that referenced this pull request Nov 23, 2026
…224)

## What does this do

Ports RigelBuild/woodpecker#188 into the fork. `SetPerm` now logs each
forge permission refresh with its duration, the age of the stored
permission, the repo, the user, and the error. A refresh over 5 s also
logs a WARN line.

## Why do we need it

RIG-11816 reports `/config` requests stalling 31 to 100 s. One suspect is
the `_forge.Repo` call in `SetPerm`. It has no timeout, and it runs when
the stored permission is over an hour old. These logs show the duration
after deploy, so the suspect can be confirmed or ruled out.

## Summary

- `forks/woodpecker/server/router/middleware/session/repo.go`: timing
  and two log lines around `_forge.Repo`. No control-flow, timeout, or
  error-handling change.

## Verification

- `gofmt -l` clean on the touched file.
- Test run off-box on macpro2013 (`go test -tags test`), see the PR body.

## Risks

One INFO line per stale-permission refresh, at most one per user and
repo per hour.

Ports RigelBuild/woodpecker#188.

## Spec impact

Spec-impact: none

Refs RIG-11816

Co-authored-by: Matt Wilkinson <matt@rigel.build>
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.

1 participant