Comments (4)
FYI, we protect the connection with a mutex in our example. So it seems reasonable to just move this mutex inside the connection struct and have proper encapsulation.
One argument against having the mutex in the connection is that in the server implementation one may have a mutex per agent anyway (e.g. to protect agent's data fields) and that same mutex can be used to protect the connection. However, we don't do it in our example (we have a separate mutex for data fields) so perhaps the combined mutex is not such a good option (otherwise why don't we use it?).
from opamp-go.
This is working as intended per the Connection interface:
opamp-go/server/types/connection.go
Lines 16 to 21 in 3f2eab4
I will do some benchmarking with a large number of connections to determine the overhead of adding a mutex per connection.
from opamp-go.
I missed this issue while working on #200. In my opinion having separate mutexes for the WS connection and the agent data fields makes sense because the cost of the mutexes is low and it would cause contention between updating the agent and sending it messages if we had a shared mutex.
@andykellr @tigrannajaryan Are we satisfied that this is resolved?
from opamp-go.
Yes, I think we can close this.
from opamp-go.
Related Issues (20)
- Set `agent_disconnect` on disconnect
- TestExtractRetryAfterHeaderHttpDate is flaky
- `rcvOpampConnectionSettings` doesn't report conn offer reject errors to Server
- `rcvCommand` should send update to Server on err HOT 5
- Command should be ignored when agent does not have AcceptsCommands capability
- TestAgentIdentification/ws is flaky HOT 2
- httpsender will always fail to do retry request
- Capability to set auth header while package download HOT 1
- Capability to set RequestInstanceUid flag in AgentToServer msg as per the spec HOT 2
- Move certs helper code from /internal/examples to /internal or /internal/testhelper? HOT 1
- Return error if `Set` methods are called after `Stop` is called in HTTP client
- [security] audit repository tooling HOT 1
- [codecov] Reports compare to old base branch HOT 1
- Allow callbacks to contain a context
- Add renovate bot to update dependencies HOT 1
- Dependency Dashboard
- `ReceiverLoop` doesn't stop on cancelling context
- Handling pending messages when client is stopped
- ServerOfferedVersion and ServerOfferedHash are never changed HOT 1
- Follow HTTP redirects on websocket handshake failure
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opamp-go.