MCPcopy Create free account
hub / github.com/openclaw/gogcli / resync

Method resync

internal/gmailwatch/processor.go:219–246  ·  view source on GitHub ↗
(ctx context.Context, source Source, notification Notification)

Source from the content-addressed store, hash-verified

217}
218
219func (p *Processor) resync(ctx context.Context, source Source, notification Notification) (*Payload, error) {
220 ids, err := source.ListRecentMessageIDs(ctx, p.Config.ResyncMax)
221 if err != nil {
222 return nil, p.openRateLimitCircuitIfNeeded(err)
223 }
224
225 batch, err := source.FetchMessages(ctx, ids)
226 if err != nil {
227 return nil, p.openRateLimitCircuitIfNeeded(err)
228 }
229
230 p.advanceHistory(notification.HistoryID, notification.MessageID, "watch: failed to update state after resync: %v")
231
232 if batch.Excluded > 0 && len(batch.Messages) == 0 {
233 if p.Config.Verbose {
234 p.logf("watch: skipping hook; all messages excluded")
235 }
236
237 return nil, ErrNoNewMessages
238 }
239
240 return &Payload{
241 Source: "gmail",
242 Account: p.Config.Account,
243 HistoryID: notification.HistoryID,
244 Messages: batch.Messages,
245 }, nil
246}
247
248func (p *Processor) advanceHistory(historyID, messageID, warning string) {
249 if err := p.Repository.AdvanceHistory(historyID, messageID, p.currentTime()); err != nil {

Callers 1

HandleMethod · 0.95

Calls 5

advanceHistoryMethod · 0.95
logfMethod · 0.95
ListRecentMessageIDsMethod · 0.65
FetchMessagesMethod · 0.65

Tested by

no test coverage detected