user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] lei_mirror: do not needlessly rewrite project-list
@ 2023-01-06 11:51 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-01-06 11:51 UTC (permalink / raw)
  To: meta

No need to cause extra wear on storage devices.
---
 lib/PublicInbox/LeiMirror.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index db249ece..87abf88c 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -1056,7 +1056,8 @@ EOM
 
 	my (undef, $dn, $bn) = File::Spec->splitpath($f);
 	$self->{chg}->{nr_chg} += scalar(@remote) + scalar(@local);
-	atomic_write($dn, $bn, join("\n", @list, ''));
+	my $new = join("\n", @list, '');
+	atomic_write($dn, $bn, $new) if $new ne $old;
 }
 
 # FIXME: this gets confused by single inbox instance w/ global manifest.js.gz

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-06 11:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 11:51 [PATCH] lei_mirror: do not needlessly rewrite project-list Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).