diff options
author | Eric Wong <e@80x24.org> | 2019-12-25 07:50:36 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-12-26 10:48:19 +0000 |
commit | bfa40d0c4a970e5af0eae0441920a491c4f6fa1d (patch) | |
tree | 49f80c0ed96b50f922401e29db8d0d16d54ec5bc /lib/PublicInbox/SolverGit.pm | |
parent | 5c94a55c24a17c8250cf80d78246851c0a7c4087 (diff) | |
download | public-inbox-bfa40d0c4a970e5af0eae0441920a491c4f6fa1d.tar.gz |
Another step towards removing anonymous subs to eliminate a possible source of memory leaks and high memory use.
Diffstat (limited to 'lib/PublicInbox/SolverGit.pm')
-rw-r--r-- | lib/PublicInbox/SolverGit.pm | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index eea59b6d..b3fc5bef 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -327,7 +327,7 @@ sub do_finish ($$) { $user_cb->(undef); } -sub do_step ($) { +sub event_step ($) { my ($self) = @_; eval { # step 1: resolve blobs to patches in the todo queue @@ -363,18 +363,13 @@ sub do_step ($) { } } -sub step_cb ($) { - my ($self) = @_; - sub { do_step($self) }; -} - sub next_step ($) { my ($self) = @_; # if outside of public-inbox-httpd, caller is expected to be - # looping step_cb, anyways + # looping event_step, anyways my $async = $self->{psgi_env}->{'pi-httpd.async'} or return; # PublicInbox::HTTPD::Async->new - $async->(undef, step_cb($self)); + $async->(undef, undef, $self); } sub mark_found ($$$) { @@ -598,12 +593,11 @@ sub solve ($$$$$) { $self->{tmp} = File::Temp->newdir("solver.$oid_want-XXXXXXXX", TMPDIR => 1); dbg($self, "solving $oid_want ..."); - my $step_cb = step_cb($self); if (my $async = $env->{'pi-httpd.async'}) { # PublicInbox::HTTPD::Async->new - $async->(undef, $step_cb); + $async->(undef, undef, $self); } else { - $step_cb->() while $self->{user_cb}; + event_step($self) while $self->{user_cb}; } } |