perf: batch gateway submits and isolate callbacks
This commit is contained in:
@@ -23,6 +23,7 @@ const (
|
||||
|
||||
type Manager struct {
|
||||
APIBaseURL string
|
||||
EventAPIBaseURL string
|
||||
HTTPClient *http.Client
|
||||
SubmitSegmentPublisher SubmitSegmentPublisher
|
||||
|
||||
@@ -170,11 +171,15 @@ func (m *Manager) ConnectionCounts() (desired int, connected int) {
|
||||
}
|
||||
|
||||
func (m *Manager) newConnectionPool(channelID string, connectionID string, config queue.UpstreamConfig) *connectionPool {
|
||||
eventAPIBaseURL := m.EventAPIBaseURL
|
||||
if eventAPIBaseURL == "" {
|
||||
eventAPIBaseURL = m.APIBaseURL
|
||||
}
|
||||
return &connectionPool{
|
||||
channelID: channelID,
|
||||
connectionID: connectionID,
|
||||
config: config,
|
||||
apiBaseURL: m.APIBaseURL,
|
||||
apiBaseURL: eventAPIBaseURL,
|
||||
httpClient: m.HTTPClient,
|
||||
reporter: func(ctx context.Context, state ConnectionState) error {
|
||||
return m.post(ctx, "/admin/gateway/connections", state)
|
||||
|
||||
Reference in New Issue
Block a user