avoid using mutex in hot path (broker/server/store) #29
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Are you sure we need start()/stop()?
Any usecase where using pointer instead of struct is useful?
I don't see mutex used in store/broker/server. Can't say about server and broker but store does need mutex on its write operation.
Start/Stop is needed because call Init may change listen address or some other major options
As i saw micro does not returned pointer to options struct, so its fine
Mutex is used in server in register func and some other, it needs to protect config options struct, as i saw now this is not needed
Init should always be called at very first. After starting server init should not be called. You can't change something in between. Also init is something that doesn't need to call frequently. You call init once and after that you run server.
I personally don't see any required usecase for using start/stop.
If you want then make it optional.
If you call Init only once and not call it after service started - you don't have any differences. If you call init after start - you don't have any errors and have unexpected behaviour.
Also if you check grpc server implementation in micro/micro it have bug - after first called Init() and before server started - additional invocations of Init() do nothing
I don't understand why would someone need to call init after service start?
that maybe an error. However usually I don't think I do init after init. If you need then instead of start stop make reinit method and do a stop then init then start inside it.
internally you call Init multiple times, for example then you specify micro.Registry, micro.Broker , micro.Router and so you internally call server.Init(server.Broker(), server.Registry() .. etc)