From 9d25eaf00d2b874ab79885cdcdd3829ea288e497 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 21 Mar 2017 22:49:51 +0000 Subject: [PATCH] extractor: do not needlessly update config file No reason to trigger excessive writes when nothing is done. --- lib/Ssoma/Extractor.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Ssoma/Extractor.pm b/lib/Ssoma/Extractor.pm index 7e2b5d1..baf9adb 100644 --- a/lib/Ssoma/Extractor.pm +++ b/lib/Ssoma/Extractor.pm @@ -47,6 +47,7 @@ sub _extract { my $lkey = "target.$target.last-imported"; my $last = $cfg->{$lkey}; + my $last_imported = $last; my $ref = $self->{ref}; my $tip = $git->qx_sha1("git rev-parse $ref^0"); @@ -106,7 +107,7 @@ sub _extract { } # update the last-imported var - { + if (!defined($last_imported) || $last_imported ne $tip) { # This state file is important, and git does not fsync it. if (open my $st, '<', $state) { # clobber existing backup -- 2.11.4.GIT