From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E82892095B; Tue, 21 Mar 2017 22:50:39 +0000 (UTC) Date: Tue, 21 Mar 2017 22:50:39 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH ssoma] extractor: do not needlessly update config file Message-ID: <20170321225039.GA3206@dcvr> References: <20170321211529.6957-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170321211529.6957-1-e@80x24.org> List-Id: 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 -- EW