Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH 2/2] Use nanosecond resolution of mtime for generating the unique id for each message
@ 2010-03-19 15:36 Michael Stapelberg
  2010-03-19 19:17 ` Mark Alexander
  2010-03-22 11:30 ` Michael Stapelberg
  0 siblings, 2 replies; 18+ messages in thread
From: Michael Stapelberg @ 2010-03-19 15:36 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

Hi,

the attached patch uses nanosecond resolution to generate the unique id for
each message of a maildir. This is necessary because I have about 2000 messages
which have the same mtime and size. I am not sure on how to properly check for
ruby 1.9 and do the right thing. Also, the user probably needs to run sup-sync
after this change. Maybe it should be implemented as a config option and be
enabled by default on new configs by sup-config? Thoughts?

Best regards,
Michael

[-- Attachment #2: 0002-Use-nanosecond-resolution-of-mtime-for-generating-th.patch --]
[-- Type: application/octet-stream, Size: 893 bytes --]

From b4bb69eeff2dc21902db9579c8ddd0f32f73047e Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Fri, 19 Mar 2010 16:32:02 +0100
Subject: [PATCH 2/2] Use nanosecond resolution of mtime for generating the unique id for each message

This requires ruby 1.9 (nanosecond resolution is not available in 1.8)
---
 lib/sup/maildir.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
index 89a947f..d0c3800 100644
--- a/lib/sup/maildir.rb
+++ b/lib/sup/maildir.rb
@@ -196,7 +196,7 @@ private
     #makes a noticeable difference on nfs.
     stat = File.stat(fn)
     # use 7 digits for the size. why 7? seems nice.
-    sprintf("%d%07d", stat.mtime, stat.size % 10000000).to_i
+    sprintf("%d%d%07d", stat.mtime, stat.mtime.tv_nsec, stat.size % 10000000).to_i
   end
 
   def new_maildir_basefn
-- 
1.6.5


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-03-25  6:43 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-19 15:36 [sup-devel] [PATCH 2/2] Use nanosecond resolution of mtime for generating the unique id for each message Michael Stapelberg
2010-03-19 19:17 ` Mark Alexander
2010-03-19 19:27   ` Michael Stapelberg
2010-03-19 19:35     ` Ben Walton
2010-03-19 19:47       ` Michael Stapelberg
2010-03-19 20:05         ` Ben Walton
2010-03-19 21:02           ` Rich Lane
2010-03-19 20:35         ` Mark Alexander
2010-03-19 21:17           ` Rich Lane
2010-03-19 19:34   ` Eric Sherman
2010-03-19 19:46     ` Michael Stapelberg
2010-03-19 20:40       ` Eric Sherman
2010-03-19 21:04         ` Mark Alexander
2010-03-20  2:23           ` Mark Alexander
2010-03-22 11:30 ` Michael Stapelberg
2010-03-22 16:25   ` Ben Walton
2010-03-25  6:25     ` Tero Tilus
2010-03-22 17:00   ` Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox