| 1 | package BenchmarkAnything::Storage::Backend::SQL::Search::MCE; | ||
| 2 | our $AUTHORITY = 'cpan:TAPPER'; | ||
| 3 | # ABSTRACT: searchengine support functions using MCE | ||
| 4 | $BenchmarkAnything::Storage::Backend::SQL::Search::MCE::VERSION = '0.029'; | ||
| 5 | use MCE::Flow; | ||
| 6 | |||
| 7 | |||
| 8 | sub sync_search_engine_mce | ||
| 9 | { | ||
| 10 | my ( $or_sql, $b_force, $i_start, $i_bulkcount) = @_; | ||
| 11 | |||
| 12 | require BenchmarkAnything::Storage::Backend::SQL::Search; | ||
| 13 | |||
| 14 | my $i_count_datapoints = $or_sql->{query}->select_count_datapoints->fetch->[0]; | ||
| 15 | |||
| 16 | MCE::Flow::init( chunk_size => $i_bulkcount, | ||
| 17 | max_workers => 8, | ||
| 18 | bounds_only => 1); | ||
| 19 | mce_flow_s sub { | ||
| 20 | BenchmarkAnything::Storage::Backend::SQL::Search::_sync_search_engine_process_chunk ($or_sql, $b_force, $_->[0], $_->[1]); | ||
| 21 | }, $i_start, $i_count_datapoints; | ||
| 22 | } | ||
| 23 | |||
| 24 | 1; | ||
| 25 | |||
| 26 | __END__ |