By making it a no-op if last_uid is not defined. This isn't a
hot code path, so the extra method dispatch isn't an issue.
It'll save some indentation/wrapping in future commits.
}
sub update_last ($$$) {
- my ($self, $validity, $last) = @_;
+ my ($self, $validity, $last_uid) = @_;
+ return unless defined $last_uid;
my $sth = $self->{dbh}->prepare_cached(<<'');
INSERT OR REPLACE INTO imap_last (url, uid_validity, uid)
VALUES (?, ?, ?)
$self->lock_acquire;
- my $rv = $sth->execute($self->{url}, $validity, $last);
+ my $rv = $sth->execute($self->{url}, $validity, $last_uid);
$self->lock_release;
$rv;
}
last if $self->{quit};
}
_done_for_now($self);
- $itrk->update_last($r_uidval, $last_uid) if defined $last_uid;
+ $itrk->update_last($r_uidval, $last_uid);
} until ($err || $self->{quit});
$err;
}
$last_art = $art;
}
_done_for_now($self);
- $itrk->update_last(0, $last_art) if defined $last_art;
+ $itrk->update_last(0, $last_art);
$err;
}