You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
현재, 스케쥴로 특정 커맨드 실행시 두번씩 실행이 되는 이슈가 있어 살펴보니, Kernel에서 scheduledPlugins 프로퍼티에 똑같은 플러그인이 두번 등록되는 이슈가 있었습니다.
코드상 $this->scheduledPlugins 에 plugin을 넣어주는 메서드인 registerPluginMethods 에서 플러그인을 등록해주는데, 해당 메서드가 스케쥴 등록과, 커맨드 등록시에 한번씩 총 두번 실행되며 중복적으로 같은 plugin이 array에 적재되어, 스케쥴을 통해 커맨드 실행시 커맨드가 두번 실행되는 현상으로 보입니다.
/** * Define the application's command schedule. * * @param Schedule $schedule Schedule instance * @return void */protectedfunctionschedule(Schedule$schedule)
{
$this->registerPluginMethods();
/** ** working with cron ** register crontab -e : * * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1 **/// plugin list in siteforeach($this->scheduledPluginsas$siteKey => $plugins) {
foreach($pluginsas$pluginObj) {
try {
$pluginObj->schedule($schedule, $siteKey);
} catch (\Exception$e) {
Log::info(sprintf('Failed Schedule Working in %s site.\n%s:%s\n%s\n%s',$siteKey,$e->getFile(),$e->getLine(),$e->getMessage(),$e->getCode()));
}
}
}
}
/** * Register the commands for the application. * * @return void */protectedfunctioncommands()
{
$this->registerPluginMethods();
require base_path('routes/console.php');
}
이를 해결하기 위해, 아래와 같이 registerPluginMethods 메서드를 통해 scheduledPlugins에 특정 plugin을 적재하기 전에, 해당 플러그인이 적재되어있는지 확인 후 적재하도록 수정하려고 합니다.
현재, 스케쥴로 특정 커맨드 실행시 두번씩 실행이 되는 이슈가 있어 살펴보니, Kernel에서
scheduledPlugins
프로퍼티에 똑같은 플러그인이 두번 등록되는 이슈가 있었습니다.코드상
$this->scheduledPlugins
에 plugin을 넣어주는 메서드인 registerPluginMethods 에서 플러그인을 등록해주는데, 해당 메서드가 스케쥴 등록과, 커맨드 등록시에 한번씩 총 두번 실행되며 중복적으로 같은 plugin이 array에 적재되어, 스케쥴을 통해 커맨드 실행시 커맨드가 두번 실행되는 현상으로 보입니다.이를 해결하기 위해, 아래와 같이
registerPluginMethods
메서드를 통해 scheduledPlugins에 특정 plugin을 적재하기 전에, 해당 플러그인이 적재되어있는지 확인 후 적재하도록 수정하려고 합니다.[이슈 작성 시점 코드]
xpressengine/app/Console/Kernel.php
Line 133 in 03ff23a
[변경 코드]
The text was updated successfully, but these errors were encountered: