Comments (7)
client.Start() will not block when namespace absent
from agollo.
what is your apollo server version?
from agollo.
what is your apollo server version?
v0.11.0 @philchia
from agollo.
Apollo will hold the request up to 60 seconds according to this wiki page
from agollo.
The initial request to this url will pass -1 as notificationId, so this request never blocks
from agollo.
It will block for at least 60 seconds if the namespace is absent, you can try it:
package main
import (
"time"
"fmt"
"net/url"
"net/http"
)
const (
ApolloServerEndpoint = "http://x.x.x.x:8080" // Apollo Config Server Endpoint
HttpClientTimeout = time.Second * 90 // Notification will timeout if < 60s when namespace absent.
)
func main() {
testAgollo("xxx", "default", "switch")
testAgollo("xxx", "default", "not-exists")
testAgollo("xxx", "default", "switch")
}
func testAgollo(app, cluster, ns string) {
t := time.Now()
defer func() {
fmt.Printf(">>>\tTime cost for namespace (%s): %v\n", ns, time.Since(t))
}()
u, _ := url.Parse(ApolloServerEndpoint)
u, _ = u.Parse("/notifications/v2")
req, _ := http.NewRequest(http.MethodGet, u.String(), nil)
args := req.URL.Query()
args.Add("appId", app)
args.Add("cluster", cluster)
args.Add("notifications", fmt.Sprintf("[{\"namespaceName\": \"%s\", \"notificationId\":-1}]", ns))
req.URL.RawQuery = args.Encode()
c := http.Client{Timeout: HttpClientTimeout}
rsp, e := c.Do(req)
if e != nil {
fmt.Println("failed to send request to apollo: ", e)
return
}
fmt.Println("apollo response code: ", rsp.StatusCode)
return
}
from agollo.
You need to query all namesapce in one request, as the application namespace is the defaut namespace, so this request will return ASAP without block
from agollo.
Related Issues (20)
- 能否支持多个 MetaAddr 地址?
- .global_default: no such file or directory HOT 2
- 能否支持自定义存储接口
- client.GetContent() will escape multiline value as wrong format. HOT 1
- client.go中的GetPropertiesContent,GetString等方法for循环处理namespace最终只会处理数组的最后一个 HOT 1
- 如何使用sdk创建一个新的namespace HOT 1
- 更新 cache dump lock 粒度
- 客户端和服务端都多实例部署的情况下,有概率出现部分客户端实例获取不到最新配置 HOT 2
- 签名需要支持sha256加密,以及https需要指定加密套件
- 提供内置的 MockClient
- 初始化配置没有切换env的配置,是否是不支持指定env? HOT 1
- GetContent获取不到内容,帮忙看下呢,不知怎么回事 HOT 4
- 建议本地缓存文件可配置是否需要生成 HOT 6
- 为什么代码非得监听application这个命名空间呢 HOT 1
- 没有考虑到默认集群更新的情况 HOT 5
- apollo启动失败,请求的登陆页面,secret配置了 HOT 4
- 缓存配置文件权限可不可以设置成600呀。
- v4 和 v3 有啥区别? HOT 1
- [QUESTION] the system cannot find the path specified HOT 1
- apollo初始化问题
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 agollo.