gotd/updates: initialize channel state runctx immediately
This commit is contained in:
@@ -397,7 +397,20 @@ func (s *internalState) RemoveChannel(channelID int64, reason error) {
|
||||
}
|
||||
|
||||
func (s *internalState) createAndRunChannelState(ctx context.Context, channelID, accessHash int64, initialPts int) (state *channelState) {
|
||||
state = s.newChannelState(channelID, accessHash, initialPts)
|
||||
state = newChannelState(ctx, channelStateConfig{
|
||||
Out: s.internalQueue,
|
||||
InitialPts: initialPts,
|
||||
ChannelID: channelID,
|
||||
AccessHash: accessHash,
|
||||
SelfID: s.selfID,
|
||||
Storage: s.storage,
|
||||
DiffLimit: s.diffLim,
|
||||
RawClient: s.client,
|
||||
Handler: s.handler,
|
||||
OnChannelTooLong: s.onTooLong,
|
||||
Logger: s.log.Named("channel").With(zap.Int64("channel_id", channelID)),
|
||||
Tracer: s.tracer,
|
||||
})
|
||||
s.channelsLock.Lock()
|
||||
s.channels[channelID] = state
|
||||
s.channelsLock.Unlock()
|
||||
@@ -415,23 +428,6 @@ func (s *internalState) createAndRunChannelState(ctx context.Context, channelID,
|
||||
return state
|
||||
}
|
||||
|
||||
func (s *internalState) newChannelState(channelID, accessHash int64, initialPts int) *channelState {
|
||||
return newChannelState(channelStateConfig{
|
||||
Out: s.internalQueue,
|
||||
InitialPts: initialPts,
|
||||
ChannelID: channelID,
|
||||
AccessHash: accessHash,
|
||||
SelfID: s.selfID,
|
||||
Storage: s.storage,
|
||||
DiffLimit: s.diffLim,
|
||||
RawClient: s.client,
|
||||
Handler: s.handler,
|
||||
OnChannelTooLong: s.onTooLong,
|
||||
Logger: s.log.Named("channel").With(zap.Int64("channel_id", channelID)),
|
||||
Tracer: s.tracer,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *internalState) getDifference(ctx context.Context) error {
|
||||
ctx, span := s.tracer.Start(ctx, "getDifference")
|
||||
defer span.End()
|
||||
|
||||
Reference in New Issue
Block a user