MCPcopy Index your code
hub / github.com/google/seesaw / poll

Method poll

engine/sync.go:451–474  ·  view source on GitHub ↗

poll polls the synchronisation server for notifications, then dispatches them for processing.

(sid SyncSessionID)

Source from the content-addressed store, hash-verified

449// poll polls the synchronisation server for notifications, then dispatches
450// them for processing.
451func (sc *syncClient) poll(sid SyncSessionID) {
452 for {
453 var sn SyncNotes
454 poll := sc.client.Go("SeesawSync.Poll", sid, &sn, nil)
455 select {
456 case <-poll.Done:
457 if poll.Error != nil {
458 log.Errorf("Synchronisation polling failed: %v", poll.Error)
459 return
460 }
461 for _, note := range sn.Notes {
462 sc.dispatch(&note)
463 }
464
465 case <-sc.quit:
466 sc.stopped <- true
467 return
468
469 case <-time.After(syncPollTimeout):
470 log.Warningf("Synchronisation polling timed out after %s", syncPollTimeout)
471 return
472 }
473 }
474}
475
476// handleNote dispatches a synchronisation note to the appropriate handler.
477func (sc *syncClient) handleNote(note *SyncNote) {

Callers 1

runOnceMethod · 0.95

Calls 1

dispatchMethod · 0.80

Tested by

no test coverage detected