diff options
author | Eric Wong <e@80x24.org> | 2016-02-29 02:48:45 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-02-29 02:48:53 +0000 |
commit | 9bae4c858d983d0f0cf7314b50f613818a58d5c5 (patch) | |
tree | 4be152084008b80929782771449b620279463884 /t/search.t | |
parent | f93cd087e460b1196322b1e8a28612fb426f1072 (diff) | |
download | public-inbox-9bae4c858d983d0f0cf7314b50f613818a58d5c5.tar.gz |
In case folks do not use eatmydata or tmpfs for testing, use transactions to reduce the number of fsync calls made and hopefully prevent drives from wearing out.
Diffstat (limited to 't/search.t')
-rw-r--r-- | t/search.t | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -34,9 +34,12 @@ ok($@, "exception raised on non-existent DB"); my $rw = PublicInbox::SearchIdx->new($git_dir, 1); my $ro = PublicInbox::Search->new($git_dir); +$rw = undef; my $rw_commit = sub { + $rw->{xdb}->commit_transaction if $rw; $rw = undef; $rw = PublicInbox::SearchIdx->new($git_dir, 1); + $rw->{xdb}->begin_transaction; }; { @@ -86,6 +89,7 @@ my $rw_commit = sub { body => "goodbye forever :<\n"); my $rv; + $rw_commit->(); $root_id = $rw->add_message($root); is($root_id, int($root_id), "root_id is an integer: $root_id"); $last_id = $rw->add_message($last); |