From 22e7956e56f3a63479b894af0ee4812ff7ae025a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 26 Aug 2020 08:17:39 +0000 Subject: [PATCH] over: rename ->disconnect to ->dbh_close Since we got rid of over->connect, `disconnect' no longer pairs with it. So name it after the `close(2)' syscall it ultimately issues. --- lib/PublicInbox/Over.pm | 4 ++-- lib/PublicInbox/OverIdx.pm | 6 +++--- lib/PublicInbox/V2Writable.pm | 4 ++-- t/over.t | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm index 0ebc8003..a2cf9f21 100644 --- a/lib/PublicInbox/Over.pm +++ b/lib/PublicInbox/Over.pm @@ -72,7 +72,7 @@ sub new { bless { filename => $f }, $class; } -sub disconnect { +sub dbh_close { my ($self) = @_; if (my $dbh = delete $self->{dbh}) { delete $self->{-get_art}; @@ -328,7 +328,7 @@ sub check_inodes { my $st = pack('dd', $st[0], $st[1]); # don't actually reopen, just let {dbh} be recreated later - disconnect($self) if $st ne ($self->{st} // $st); + dbh_close($self) if $st ne ($self->{st} // $st); } else { warn "W: stat $f: $!\n"; } diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index c521464a..512c5f46 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -455,10 +455,10 @@ sub rollback_lazy { $self->{dbh}->rollback; } -sub disconnect { +sub dbh_close { my ($self) = @_; die "in transaction" if $self->{txn}; - $self->SUPER::disconnect; + $self->SUPER::dbh_close; } sub create { @@ -470,7 +470,7 @@ sub create { } # create the DB: PublicInbox::Over::dbh($self); - $self->disconnect; + $self->dbh_close; } sub rethread_prepare { diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index c926446c..f2288904 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -679,8 +679,8 @@ sub done { $err .= "shard close: $@\n" if $@; } } - eval { $self->{over}->disconnect }; - $err .= "over disconnect: $@\n" if $@; + eval { $self->{over}->dbh_close }; + $err .= "over close: $@\n" if $@; delete $self->{bnote}; my $nbytes = $self->{total_bytes}; $self->{total_bytes} = 0; diff --git a/t/over.t b/t/over.t index 6c4c8ee6..41c13872 100644 --- a/t/over.t +++ b/t/over.t @@ -23,7 +23,7 @@ $y = $over->sid('hello-WORLD'); is($y, $x+1, 'sid increases'); is($over->sid('hello-world'), $x, 'idempotent'); ok(!$over->{dbh}->{ReadOnly}, 'OverIdx is not ReadOnly'); -$over->disconnect; +$over->dbh_close; $over = PublicInbox::Over->new("$tmpdir/over.sqlite3"); ok($over->dbh->{ReadOnly}, 'Over is ReadOnly'); -- 2.44.0