Skip to content

Commit

Permalink
Merge pull request #115 from Nicklas373/dev/be/master
Browse files Browse the repository at this point in the history
v3.2.4 20240421
  • Loading branch information
Nicklas373 committed Apr 21, 2024
2 parents e5cde8d + a27570d commit 0447810
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 105 deletions.
64 changes: 32 additions & 32 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ protected function schedule(Schedule $schedule): void
->weekly()
->environments(['production'])
->timezone('Asia/Jakarta')
->before(function(AppHelper $helper) use($cacheClearGUID) {
->before(function(AppHelper $helper) use($optimizeClearGUID) {
DB::table('appLogs')
->insert([
'processId' => $cacheClearGUID,
'processId' => $optimizeClearGUID,
'errReason' => null,
'errApiReason' => null,
]);
Expand All @@ -101,49 +101,49 @@ protected function schedule(Schedule $schedule): void
'jobsEnv' => 'production',
'jobsRuntime' => 'weekly',
'jobsResult' => false,
'processId' => $cacheClearGUID,
'processId' => $optimizeClearGUID,
'procStartAt' => $helper::instance()->getCurrentTimeZone(),
'procEndAt' => null
]);
})
->after(function(AppHelper $helper, Stringable $output) use($cacheClearGUID,$startProc) {
->after(function(AppHelper $helper, Stringable $output) use($optimizeClearGUID,$startProc) {
$start = Carbon::parse($startProc);
$end = Carbon::parse($helper::instance()->getCurrentTimeZone());
$duration = $end->diff($start);
if ($output == null || $output == '' || empty($output)) {
DB::table('jobLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $optimizeClearGUID)
->update([
'jobsResult' => true,
'procEndAt' => $end,
'procDuration' => $duration->s.' seconds'
]);
} else {
DB::table('jobLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $optimizeClearGUID)
->update([
'jobsResult' => false,
'procEndAt' => $end,
'procDuration' => $duration->s.' seconds'
]);
DB::table('appLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $optimizeClearGUID)
->update([
'errReason' => 'Laravel Scheduler Error !',
'errApiReason' => $output,
]);
NotificationHelper::Instance()->sendSchedErrNotify('optimize:clear','weekly', $cacheClearGUID, 'FAIL','Laravel Scheduler Error !',$output);
NotificationHelper::Instance()->sendSchedErrNotify('optimize:clear','weekly', $optimizeClearGUID, 'FAIL','Laravel Scheduler Error !',$output);
}
});
$schedule
->command('view:clear')
->weekly()
->environments(['production'])
->timezone('Asia/Jakarta')
->before(function(AppHelper $helper) use($cacheClearGUID) {
->before(function(AppHelper $helper) use($viewClearGUID) {
DB::table('appLogs')
->insert([
'processId' => $cacheClearGUID,
'processId' => $viewClearGUID,
'errReason' => null,
'errApiReason' => null,
]);
Expand All @@ -152,49 +152,49 @@ protected function schedule(Schedule $schedule): void
'jobsEnv' => 'production',
'jobsRuntime' => 'weekly',
'jobsResult' => false,
'processId' => $cacheClearGUID,
'processId' => $viewClearGUID,
'procStartAt' => $helper::instance()->getCurrentTimeZone(),
'procEndAt' => null
]);
})
->after(function(AppHelper $helper, Stringable $output) use($cacheClearGUID,$startProc) {
->after(function(AppHelper $helper, Stringable $output) use($viewClearGUID,$startProc) {
$start = Carbon::parse($startProc);
$end = Carbon::parse($helper::instance()->getCurrentTimeZone());
$duration = $end->diff($start);
if ($output == null || $output == '' || empty($output)) {
DB::table('jobLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $viewClearGUID)
->update([
'jobsResult' => true,
'procEndAt' => $end,
'procDuration' => $duration->s.' seconds'
]);
} else {
DB::table('jobLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $viewClearGUID)
->update([
'jobsResult' => false,
'procEndAt' => $end,
'procDuration' => $duration->s.' seconds'
]);
DB::table('appLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $viewClearGUID)
->update([
'errReason' => 'Laravel Scheduler Error !',
'errApiReason' => $output,
]);
NotificationHelper::Instance()->sendSchedErrNotify('view:clear','weekly', $cacheClearGUID, 'FAIL','Laravel Scheduler Error !',$output);
NotificationHelper::Instance()->sendSchedErrNotify('view:clear','weekly', $viewClearGUID, 'FAIL','Laravel Scheduler Error !',$output);
}
});
$schedule
->command('view:cache')
->weekly()
->environments(['production'])
->timezone('Asia/Jakarta')
->before(function(AppHelper $helper) use($cacheClearGUID) {
->before(function(AppHelper $helper) use($viewCacheGUID) {
DB::table('appLogs')
->insert([
'processId' => $cacheClearGUID,
'processId' => $viewCacheGUID,
'errReason' => null,
'errApiReason' => null,
]);
Expand All @@ -203,49 +203,49 @@ protected function schedule(Schedule $schedule): void
'jobsEnv' => 'production',
'jobsRuntime' => 'weekly',
'jobsResult' => false,
'processId' => $cacheClearGUID,
'processId' => $viewCacheGUID,
'procStartAt' => $helper::instance()->getCurrentTimeZone(),
'procEndAt' => null
]);
})
->after(function(AppHelper $helper, Stringable $output) use($cacheClearGUID,$startProc) {
->after(function(AppHelper $helper, Stringable $output) use($viewCacheGUID,$startProc) {
$start = Carbon::parse($startProc);
$end = Carbon::parse($helper::instance()->getCurrentTimeZone());
$duration = $end->diff($start);
if ($output == null || $output == '' || empty($output)) {
DB::table('jobLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $viewCacheGUID)
->update([
'jobsResult' => true,
'procEndAt' => $end,
'procDuration' => $duration->s.' seconds'
]);
} else {
DB::table('jobLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $viewCacheGUID)
->update([
'jobsResult' => false,
'procEndAt' => $end,
'procDuration' => $duration->s.' seconds'
]);
DB::table('appLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $viewCacheGUID)
->update([
'errReason' => 'Laravel Scheduler Error !',
'errApiReason' => $output,
]);
NotificationHelper::Instance()->sendSchedErrNotify('view:cache','weekly', $cacheClearGUID, 'FAIL','Laravel Scheduler Error !',$output);
NotificationHelper::Instance()->sendSchedErrNotify('view:cache','weekly', $viewCacheGUID, 'FAIL','Laravel Scheduler Error !',$output);
}
});
$schedule
->command('hana:clear-storage')
->hourly()
->timezone('Asia/Jakarta')
->environments(['production'])
->before(function(AppHelper $helper) use($cacheClearGUID) {
->before(function(AppHelper $helper) use($hanaClearGUID) {
DB::table('appLogs')
->insert([
'processId' => $cacheClearGUID,
'processId' => $hanaClearGUID,
'errReason' => null,
'errApiReason' => null,
]);
Expand All @@ -254,38 +254,38 @@ protected function schedule(Schedule $schedule): void
'jobsEnv' => 'production',
'jobsRuntime' => 'hourly',
'jobsResult' => false,
'processId' => $cacheClearGUID,
'processId' => $hanaClearGUID,
'procStartAt' => $helper::instance()->getCurrentTimeZone(),
'procEndAt' => null
]);
})
->after(function(AppHelper $helper, Stringable $output) use($cacheClearGUID,$startProc) {
->after(function(AppHelper $helper, Stringable $output) use($hanaClearGUID,$startProc) {
$start = Carbon::parse($startProc);
$end = Carbon::parse($helper::instance()->getCurrentTimeZone());
$duration = $end->diff($start);
if ($output == null || $output == '' || empty($output)) {
DB::table('jobLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $hanaClearGUID)
->update([
'jobsResult' => true,
'procEndAt' => $end,
'procDuration' => $duration->s.' seconds'
]);
} else {
DB::table('jobLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $hanaClearGUID)
->update([
'jobsResult' => false,
'procEndAt' => $end,
'procDuration' => $duration->s.' seconds'
]);
DB::table('appLogs')
->where('processId', '=', $cacheClearGUID)
->where('processId', '=', $hanaClearGUID)
->update([
'errReason' => 'Laravel Scheduler Error !',
'errApiReason' => $output,
]);
NotificationHelper::Instance()->sendSchedErrNotify('hana:clear-storage','hourly', $cacheClearGUID, 'FAIL','Laravel Scheduler Error !',$output);
NotificationHelper::Instance()->sendSchedErrNotify('hana:clear-storage','hourly', $hanaClearGUID, 'FAIL','Laravel Scheduler Error !',$output);
}
});
}
Expand Down

0 comments on commit 0447810

Please sign in to comment.