mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 22:56:48 +00:00
test: add test with changing address order
This commit is contained in:
@ -34,6 +34,7 @@ const pollIntervalSpread = 5 * time.Second
|
||||
type eventLoop struct {
|
||||
cache *Cache
|
||||
currentEventID string
|
||||
currentEvent *pmapi.Event
|
||||
pollCh chan chan struct{}
|
||||
stopCh chan struct{}
|
||||
notifyStopCh chan struct{}
|
||||
@ -136,13 +137,18 @@ func (loop *eventLoop) start() { // nolint[funlen]
|
||||
loop.log.WithField("lastEventID", loop.currentEventID).Warn("Subscription stopped")
|
||||
}()
|
||||
|
||||
t := time.NewTicker(pollInterval - pollIntervalSpread)
|
||||
defer t.Stop()
|
||||
|
||||
loop.hasInternet = true
|
||||
|
||||
go loop.pollNow()
|
||||
|
||||
loop.loop()
|
||||
}
|
||||
|
||||
// loop is the main body of the event loop.
|
||||
func (loop *eventLoop) loop() {
|
||||
t := time.NewTicker(pollInterval - pollIntervalSpread)
|
||||
defer t.Stop()
|
||||
|
||||
for {
|
||||
var eventProcessedCh chan struct{}
|
||||
select {
|
||||
@ -251,6 +257,8 @@ func (loop *eventLoop) processNextEvent() (more bool, err error) { // nolint[fun
|
||||
return false, errors.Wrap(err, "failed to get event")
|
||||
}
|
||||
|
||||
loop.currentEvent = event
|
||||
|
||||
if event == nil {
|
||||
return false, errors.New("received empty event")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user