diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-05-19 09:15:03 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-05-19 09:15:03 +0200 |
commit | 1d78433ff8f8490ec942d6601ef800406355f6ca (patch) | |
tree | 4ab52b077e52658227df3d46db8a8168f7b38c97 | |
parent | 119e9660f5312cb83cf4a391417476966f5a1fe6 (diff) |
hashl update: Save db when being interrupted, increase autosave interval
-rw-r--r-- | Changelog | 4 | ||||
-rwxr-xr-x | bin/hashl | 10 |
2 files changed, 12 insertions, 2 deletions
@@ -1,7 +1,9 @@ git HEAD * The internal representation of ignored hashes was changed - * "hashl update" no longer re-adds ignored (but existing) files + * hashl update no longer re-adds ignored (but existing) files + * hashl update now saves its state when being interrupted + (sigint/sigterm) hashl 0.1 - Fri May 06 2011 @@ -65,6 +65,14 @@ else { ); } +$SIG{INT} = \&quit_save_db; +$SIG{TERM} = \&quit_save_db; + +sub quit_save_db { + $hashl->save($db_file); + exit 0; +} + sub get_total { my $file = $File::Find::name; if (-f $file and not -l $file and $file ne $db_file) { @@ -157,7 +165,7 @@ sub process_file { &{$code}($file, $path); - if ($write and (($cur % 100) == 0)) { + if ($write and (($cur % 5000) == 0)) { $hashl->save($db_file); } } |