mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-25 04:27:22 +08:00
update meilisearch move to schedule run command
This commit is contained in:
@@ -35,8 +35,8 @@ class Kernel extends ConsoleKernel
|
|||||||
$schedule->command('claim:settle')->hourly()->when(function () {
|
$schedule->command('claim:settle')->hourly()->when(function () {
|
||||||
return Carbon::now()->format('d') == '01';
|
return Carbon::now()->format('d') == '01';
|
||||||
})->withoutOverlapping();
|
})->withoutOverlapping();
|
||||||
|
$schedule->command('meilisearch:import')->weeklyOn(1, "03:00")->withoutOverlapping();
|
||||||
|
|
||||||
// $schedule->command('plugin:cronjob')->everyMinute()->withoutOverlapping();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class MeiliSearchRepository extends BaseRepository
|
|||||||
$swapResult = $client->swapIndexes([[self::INDEX_NAME, $indexName]]);
|
$swapResult = $client->swapIndexes([[self::INDEX_NAME, $indexName]]);
|
||||||
$times = 0;
|
$times = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
if ($times == 600) {
|
if ($times == 3600) {
|
||||||
$msg = "total: $total, swap too long, times: $times, return false";
|
$msg = "total: $total, swap too long, times: $times, return false";
|
||||||
do_log($msg);
|
do_log($msg);
|
||||||
throw new NexusException($msg);
|
throw new NexusException($msg);
|
||||||
|
|||||||
+10
-9
@@ -958,16 +958,17 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
|||||||
printProgress($log);
|
printProgress($log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//cost too many time, migrate to schedule run command
|
||||||
//sync to Meilisearch
|
//sync to Meilisearch
|
||||||
$meiliRep = new \App\Repositories\MeiliSearchRepository();
|
// $meiliRep = new \App\Repositories\MeiliSearchRepository();
|
||||||
if ($meiliRep->isEnabled()) {
|
// if ($meiliRep->isEnabled()) {
|
||||||
$meiliRep->import();
|
// $meiliRep->import();
|
||||||
}
|
// }
|
||||||
$log = "sync to Meilisearch";
|
// $log = "sync to Meilisearch";
|
||||||
do_log($log);
|
// do_log($log);
|
||||||
if ($printProgress) {
|
// if ($printProgress) {
|
||||||
printProgress($log);
|
// printProgress($log);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//Priority Class 5: cleanup every 15 days
|
//Priority Class 5: cleanup every 15 days
|
||||||
$res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime5'");
|
$res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime5'");
|
||||||
|
|||||||
Reference in New Issue
Block a user