Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Michael Stapelberg <michael+sup@stapelberg.de>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] [PATCH 2/2] Use nanosecond resolution of mtime for generating the unique id for each message
Date: Fri, 19 Mar 2010 16:36:37 +0100	[thread overview]
Message-ID: <1269012878-sup-691@midna.zekjur.net> (raw)

[-- 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

             reply	other threads:[~2010-03-19 15:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19 15:36 Michael Stapelberg [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1269012878-sup-691@midna.zekjur.net \
    --to=michael+sup@stapelberg.de \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox