summaryrefslogtreecommitdiff
path: root/lib/MaildirIndexer/Store.rakumod
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MaildirIndexer/Store.rakumod')
-rw-r--r--lib/MaildirIndexer/Store.rakumod9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/MaildirIndexer/Store.rakumod b/lib/MaildirIndexer/Store.rakumod
index 02ffa1d..791f9a4 100644
--- a/lib/MaildirIndexer/Store.rakumod
+++ b/lib/MaildirIndexer/Store.rakumod
@@ -25,12 +25,12 @@ method start(--> Nil) {
MaildirIndexer::LogTimelineSchema::Scan::End.log();
}
when $file ~~ :e & :f {
- MaildirIndexer::LogTimelineSchema::Store::Add.log: :file($file.path), {
+ MaildirIndexer::LogTimelineSchema::Store::Add.log: :file($file.path), -> {
self.add-file($file);
}
}
when $file ~~ :!e {
- MaildirIndexer::LogTimelineSchema::Store::Rm.log: :file($file.path), {
+ MaildirIndexer::LogTimelineSchema::Store::Rm.log: :file($file.path), -> {
self.del-file($file);
}
}
@@ -57,14 +57,15 @@ method del-file(IO:D $file --> Nil) {
}
method mailbox-for-email(MaildirIndexer::Email:D $email --> Str) {
+ my Str $result;
MaildirIndexer::LogTimelineSchema::Store::Find.log: {
$!lock.protect: {
for @!indices -> $index {
- with $index.mailbox-for-email($email) { return $_ };
+ with $index.mailbox-for-email($email) { $result = $_; last };
}
}
- return Nil;
}
+ return $result;
}
sub mailbox-from-path(Str() $path --> Str) {