[mirrorbrain-commits] r7981 - /trunk/mirrordoctor/mb/hashes.py

From: <poeml_at_mirrorbrain.org>
Date: Thu, 11 Mar 2010 21:46:54 -0000
Author: poeml
Date: Thu Mar 11 22:46:53 2010
New Revision: 7981

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=7981&view=rev
Log:
mb makehashes: 
- Subsecond modification times are prevented from being saved to the database
  now, which could result in a rounding error.
- In the new code path for hashes stored in the database, handle the case where
  a hash needs to be refreshed, e.g. because a file has been touched.

Modified:
    trunk/mirrordoctor/mb/hashes.py

Modified: trunk/mirrordoctor/mb/hashes.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mirrordoctor/mb/hashes.py?rev=7981&r1=7980&r2=7981&view=diff
==============================================================================
--- trunk/mirrordoctor/mb/hashes.py (original)
+++ trunk/mirrordoctor/mb/hashes.py Thu Mar 11 22:46:53 2010
@@ -139,7 +139,7 @@
                                  decode(%s, 'hex'), decode(%s, 'hex'), 
                                  decode(%s, 'hex'), %s, decode(%s, 'hex'),
                                  %s )""",
-                      [file_id, self.mtime, self.size,
+                      [file_id, int(self.mtime), self.size,
                        self.hb.md5hex,
                        self.hb.sha1hex,
                        self.hb.sha256hex or '',
@@ -150,10 +150,15 @@
                 print 'Hash was not present yet in database - inserted'
         else:
             mtime, size = res[1], res[2]
+            
             if int(self.mtime) == mtime and self.size == size and not force:
                 if verbose:
                     print 'Up to date in db: %r' % self.src_rel
                 return
+
+            if self.hb.empty:
+                self.hb.fill(verbose=verbose)
+
             c.execute("""UPDATE hash set mtime = %s, size = %s, 
                                          md5 = decode(%s, 'hex'), 
                                          sha1 = decode(%s, 'hex'), 




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Thu Mar 11 2010 - 21:46:57 GMT

This archive was generated by hypermail 2.2.0 : Thu Mar 11 2010 - 21:47:06 GMT