-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: client support credentialsProvider #216
Conversation
if now >= t.expirationInMills { | ||
return true | ||
} | ||
duration := (float64)(t.expirationInMills-t.lastUpdatedInMills) * t.expiredFactor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
即使 < 0 也没关系,一样会return true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里主要是担心客户端时间不严格有序
credentials_provider.go
Outdated
@@ -166,116 +174,16 @@ func (adp *UpdateFuncProviderAdapter) GetCredentials() (Credentials, error) { | |||
// Returns true if no credentials ever fetched or credentials expired, | |||
// or credentials will be expired soon | |||
func (adp *UpdateFuncProviderAdapter) shouldRefresh() bool { | |||
adp.mutex.RLock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要用mutex,和atomic相比性能相差几十、上百倍,参考:https://github.com/uber-go/atomic
credentials_provider.go
Outdated
return accessKeyID != "" && accessKeySecret != "" && expirationTime.UnixMilli() > 0 | ||
} | ||
|
||
const ECS_RAM_ROLE_URL_PREFIX = "http://100.100.100.200/latest/meta-data/ram/security-credentials/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我的意思并不是直接不要ECS RAM ROLE的功能,而是没必要再写一次冗余的ECS..Provider代码,其他的还是可以留着
producer/producer_config.go
Outdated
NoRetryStatusCodeList []int | ||
StsTokenShutDown chan struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StsTokenShutDown 也要挪下来
No description provided.