1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-26 03:52:12 +02:00

feat(resolver/discovery): expose create watcher timeout error (#3392)

This commit is contained in:
ThereWeGo 2024-08-19 10:53:07 +08:00 committed by GitHub
parent 084c8b4167
commit 642790484c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,6 +14,8 @@ import (
const name = "discovery"
var ErrWatcherCreateTimeout = errors.New("discovery create watcher overtime")
// Option is builder option.
type Option func(o *builder)
@ -96,7 +98,7 @@ func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, _ resolv
case <-done:
err = watchRes.err
case <-time.After(b.timeout):
err = errors.New("discovery create watcher overtime")
err = ErrWatcherCreateTimeout
}
if err != nil {
cancel()