Do not ping event targets during cluster initialization (#19959)

S3 operations are frozen during startup, therefore we should avoid pinging
event targets during the initialization since it can stall.
This commit is contained in:
Anis Eleuch 2024-06-20 15:46:02 +01:00 committed by GitHub
parent 2825294b7b
commit 95e4cbbfde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 9 deletions

View File

@ -2417,7 +2417,7 @@ func getServerInfo(ctx context.Context, pools, metrics bool, r *http.Request) ma
Mode: string(mode),
Domain: domain,
Region: globalSite.Region(),
SQSARN: globalEventNotifier.GetARNList(false),
SQSARN: globalEventNotifier.GetARNList(),
DeploymentID: globalDeploymentID(),
Buckets: buckets,
Objects: objects,

View File

@ -49,23 +49,18 @@ func NewEventNotifier(ctx context.Context) *EventNotifier {
}
// GetARNList - returns available ARNs.
func (evnot *EventNotifier) GetARNList(onlyActive bool) []string {
func (evnot *EventNotifier) GetARNList() []string {
arns := []string{}
if evnot == nil {
return arns
}
region := globalSite.Region()
for targetID, target := range evnot.targetList.TargetMap() {
for targetID := range evnot.targetList.TargetMap() {
// httpclient target is part of ListenNotification
// which doesn't need to be listed as part of the ARN list
// This list is only meant for external targets, filter
// this out pro-actively.
if !strings.HasPrefix(targetID.ID, "httpclient+") {
if onlyActive {
if _, err := target.IsActive(); err != nil {
continue
}
}
arns = append(arns, targetID.ToARN(region).String())
}
}

View File

@ -158,7 +158,7 @@ func printEventNotifiers() {
return
}
arns := globalEventNotifier.GetARNList(true)
arns := globalEventNotifier.GetARNList()
if len(arns) == 0 {
return
}