1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-07-06 22:35:51 +02:00

Subscribe error handling (#2785)

* [fix] etcd config source prefix issue (#2389)

* http transport data race issue (#2436)

* [fix] #2431 http transport data race issue

* [feature] Ability to close connection while receiving.
Ability to send messages while receiving.
Icreased r channel limit to 100 to more fluently communication.
Do not dropp sent request if r channel is full.

* [feature] always subscribes to all topics and if there is an error in one of them, the unsuccessful topics will be subscribed to again

---------

Co-authored-by: Johnson C <chengqiaosheng@gmail.com>
This commit is contained in:
Ak-Army
2025-06-04 09:55:17 +02:00
committed by GitHub
parent 0e45edf439
commit 88f38eaef6
2 changed files with 30 additions and 25 deletions

View File

@ -446,17 +446,6 @@ func (s *rpcServer) Register() error {
// Set what we're advertising
s.opts.Advertise = addr
// Router can exchange messages on broker
// Subscribe to the topic with its own name
if err := s.subscribeServer(config); err != nil {
return errors.Wrap(err, "failed to subscribe to service name topic")
}
// Subscribe for all of the subscribers
if err := s.reSubscribe(config); err != nil {
return errors.Wrap(err, "failed to resubscribe")
}
return nil
}
@ -606,18 +595,28 @@ func (s *rpcServer) newRegFuc(config Options) func(service *registry.Service) er
// Attempt to register. If registration fails, back off and try again.
// TODO: see if we can improve the retry mechanism. Maybe retry lib, maybe config values
for i := 0; i < 3; i++ {
if err := config.Registry.Register(service, rOpts...); err != nil {
regErr = err
if regErr = config.Registry.Register(service, rOpts...); regErr != nil {
time.Sleep(backoff.Do(i + 1))
continue
}
return nil
break
}
return regErr
if regErr != nil {
return regErr
}
s.Lock()
defer s.Unlock()
// Router can exchange messages on broker
// Subscribe to the topic with its own name
if err := s.subscribeServer(config); err != nil {
return errors.Wrap(err, "failed to subscribe to service name topic")
}
// Subscribe for all of the subscribers
s.reSubscribe(config)
return nil
}
}