Class: Imap::Backup::FlagRefresher

Inherits:
Object
  • Object
show all
Defined in:
lib/imap/backup/flag_refresher.rb

Overview

Updates the flags on backed-up emails

Constant Summary collapse

CHUNK_SIZE =

The number of messages to process at a time

100

Instance Method Summary collapse

Constructor Details

#initialize(folder, serializer) ⇒ FlagRefresher

Returns a new instance of FlagRefresher.



9
10
11
12
# File 'lib/imap/backup/flag_refresher.rb', line 9

def initialize(folder, serializer)
  @folder = folder
  @serializer = serializer
end

Instance Method Details

#runvoid

This method returns an undefined value.

Runs the update



16
17
18
19
20
21
22
# File 'lib/imap/backup/flag_refresher.rb', line 16

def run
  uids = serializer.uids.clone

  uids.each_slice(CHUNK_SIZE) do |block|
    refresh_block block
  end
end