aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-28 15:23:27 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-28 15:23:27 -0500
commit63f531b97fb4c84d5f13ba2312cf08f75d30d01a (patch)
tree8b857a8a361ead35b145c50caae6c6e0dfa36101
parent354d5a8b6648ab15290540abe100a30cce388847 (diff)
downloadmbsyncloop-63f531b97fb4c84d5f13ba2312cf08f75d30d01a.tar.gz
mbsyncloop-63f531b97fb4c84d5f13ba2312cf08f75d30d01a.zip
fix channel selection
-rwxr-xr-xmbsyncloop13
1 files changed, 10 insertions, 3 deletions
diff --git a/mbsyncloop b/mbsyncloop
index d55806b..4743e92 100755
--- a/mbsyncloop
+++ b/mbsyncloop
@@ -32,11 +32,18 @@ if (!$pid) {
exit;
}
-my $last = 0;
+my $last_all = 0;
while (1) {
my $now = time;
- my $channel = ($now - $last) > 15 * 60 ? "all" : "priority";
- $last = $now;
+
+ my $channel;
+ if ($now - $last_all > 15 * 60) {
+ $last_all = $now;
+ $channel = "all";
+ }
+ else {
+ $channel = "priority";
+ }
system("mbsync -c ~/.mbsyncloop $channel") and last;
system("notmuch new | grep -v '^No new mail\.\$'");