forgejo/services/context
Mathieu Fenniak 1d02b74f62 fix: prevent deadlocks updating repo.num_action_runs/num_closed_action_runs (#9927)
Fixes #9846.  The number of open action runs on a repo is not precomputed and stored on the repo, but is computed as needed and cached.  The computation is faster than the update because it only calculates the smaller set of which action runs are not completed (as opposed to counting all of them).

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9927
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-11-02 22:24:56 +01:00
..
upload Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
access_log.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
api.go feat: make upload URL compatible with GitHub API (#9285) 2025-09-15 15:53:35 +02:00
api_org.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
api_test.go feat: make upload URL compatible with GitHub API (#9285) 2025-09-15 15:53:35 +02:00
base.go fix: omit Content-Length on 307 redirects when serving direct manifest for containers (#8037) 2025-06-09 08:43:41 +02:00
base_test.go fix: omit Content-Length on 307 redirects when serving direct manifest for containers (#8037) 2025-06-09 08:43:41 +02:00
captcha.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
context.go feat: replace cross origin protection (#9830) 2025-10-29 22:43:22 +01:00
context_cookie.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
context_model.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
context_request.go Move context from modules to services (#29440) 2024-03-06 12:10:43 +08:00
context_response.go fix: GLOBAL_TWO_FACTOR_REQUIREMENT=all prevents actions/checkout from cloning repositories (#9764) 2025-10-20 16:41:28 +02:00
context_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
org.go fix: do visibility check for user redirect lookup 2025-08-30 09:37:25 +02:00
package.go feat: Global 2FA enforcement (#8753) 2025-08-15 10:56:45 +02:00
pagination.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
permission.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
private.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
quota.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo.go fix: prevent deadlocks updating repo.num_action_runs/num_closed_action_runs (#9927) 2025-11-02 22:24:56 +01:00
repository.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
response.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
user.go fix: do visibility check for user redirect lookup 2025-08-30 09:37:25 +02:00
utils.go Move context from modules to services (#29440) 2024-03-06 12:10:43 +08:00