1
0
mirror of https://github.com/labstack/echo.git synced 2025-02-03 13:11:39 +02:00
echo/middleware
Becir Basic 5b36ce3612
Fixes the concurrency issue of calling the Next() proxy target on RRB (#2409)
* Fixes the concurrency issue of calling the `Next()` proxy target on round robin balancer

- fixed concurrency issue in `AddTarget()`
- moved `rand.New()` to the random balancer initializer func.
- internal code reorganized eliminating unnecessary pointer redirection
- employing `sync.Mutex` instead of `RWMutex` which brings additional overhead of tracking readers and writers. No need for that since the guarded code has no long-running operations, hence no realistic congestion.
- added additional guards without which the code would otherwise panic (e.g., the case where a random value is calculation when targets list is empty)
- added descriptions for func return values, what to expect in which case.
- Improve code test coverage

---------

Co-authored-by: Becir Basic <bb@neotel.at>
2023-02-24 20:32:41 +02:00
..
2022-10-12 21:47:21 +03:00
2022-11-21 15:59:14 +02:00
2022-11-21 15:59:14 +02:00
2022-11-21 15:59:14 +02:00
2022-11-21 15:59:14 +02:00
2022-11-21 15:59:14 +02:00
2022-10-12 21:47:21 +03:00
2022-12-17 11:16:00 +02:00
2022-11-21 15:59:14 +02:00
2022-11-12 23:56:47 +02:00
2023-02-22 00:00:52 +02:00
2023-02-22 00:00:52 +02:00
2023-02-22 00:00:52 +02:00
2023-02-19 20:26:17 +02:00
2022-03-16 08:09:29 +02:00