<!-- Provide a general summary of your changes in the Title above -->
## Description
<!-- Describe your changes in detail -->
Fixes request pipeline blocking when MDCB is unavailable by making org
session fetches non-blocking in RPC mode.
## Related Issue
<!-- This project only accepts pull requests related to open issues. -->
<!-- If suggesting a new feature or change, please discuss it in an
issue first. -->
<!-- If fixing a bug, there should be an issue describing it with steps
to reproduce. -->
<!-- OSS: Please link to the issue here. Tyk: please create/link the
JIRA ticket. -->
[TT-15954](https://tyktech.atlassian.net/browse/TT-15954)
## Motivation and Context
<!-- Why is this change required? What problem does it solve? -->
When MDCB is unavailable, synchronous RPC calls to fetch org sessionsin
OrganizationMonitor were blocking the request pipeline for 90-120
seconds
## How This Has Been Tested
<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests -->
<!-- you ran to see how your change affects other areas of the code,
etc. -->
<!-- This information is helpful for reviewers and QA. -->
## Screenshots (if appropriate)
## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test
coverage to functionality)
## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply -->
<!-- If there are no documentation updates required, mark the item as
checked. -->
<!-- Raise up any additional concerns not covered by the checklist. -->
- [ ] I ensured that the documentation is up to date
- [ ] I explained why this PR updates go.mod in detail with reasoning
why it's required
- [ ] I would like a code coverage CI quality gate exception and have
explained why
[TT-15954]:
https://tyktech.atlassian.net/browse/TT-15954?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!---TykTechnologies/jira-linter starts here-->
### Ticket Details
<details>
<summary>
<a href="https://tyktech.atlassian.net/browse/TT-15954" title="TT-15954"
target="_blank">TT-15954</a>
</summary>
| | |
|---------|----|
| Status | In Code Review |
| Summary | Request pipeline blocked by synchronous RPC calls every 10
minutes when MDCB unavailable |
Generated at: 2025-11-20 13:06:06
</details>
<!---TykTechnologies/jira-linter ends here-->
---------
Co-authored-by: andrei-tyk <97896463+andrei-tyk@users.noreply.github.com>
(cherry picked from commit 30461c4)
User description
TT-15954: Make org session fetch non-blocking (#7531)
Description
Fixes request pipeline blocking when MDCB is unavailable by making org
session fetches non-blocking in RPC mode.
Related Issue
TT-15954
Motivation and Context
When MDCB is unavailable, synchronous RPC calls to fetch org sessionsin
OrganizationMonitor were blocking the request pipeline for 90-120
seconds
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
functionality to change)
coverage to functionality)
Checklist
why it's required
explained why
Ticket Details
TT-15954
Generated at: 2025-11-20 13:06:06
Co-authored-by: andrei-tyk 97896463+andrei-tyk@users.noreply.github.com
PR Type
Bug fix
Description
Make org session fetch non-blocking in RPC
Add singleflight to dedupe session fetches
Async refresh for org session expiry cache
Add tests for async behavior and RPC mode
Diagram Walkthrough
File Walkthrough
mw_organisation_activity_test.go
Tests for async org session fetch and RPC modegateway/mw_organisation_activity_test.go
middleware_test.go
Tests for async org session expiry refreshgateway/middleware_test.go
mw_organisation_activity.go
Non-blocking org session fetch with singleflightgateway/mw_organisation_activity.go
middleware.go
Async org expiry refresh and emergency defaultsgateway/middleware.go
coverage.out
Add coverage report artifactgateway/coverage.out