Skip to content

Commit

Permalink
#241 All horizon environments now have their separate queues so they …
Browse files Browse the repository at this point in the history
…won't cannibalize another environment's jobs.
  • Loading branch information
Wotuu committed Jun 11, 2020
1 parent a15cd58 commit 7c40354
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 17 deletions.
7 changes: 2 additions & 5 deletions app/Console/Kernel.php
Expand Up @@ -27,13 +27,10 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
Log::channel('scheduler')->debug("Starting scheduler");

// $schedule->command('inspire')
// ->hourly();
Log::channel('scheduler')->debug('Starting scheduler');
$schedule->call(new FindOutdatedThumbnails)->everyFiveMinutes();
$schedule->call(new DeleteExpiredDungeonRoutes)->hourly();
Log::channel('scheduler')->debug("Finished scheduler");
Log::channel('scheduler')->debug('Finished scheduler');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Logic/Scheduler/FindOutdatedThumbnails.php
Expand Up @@ -47,10 +47,10 @@ function __invoke()
((// Updated at is greater than the thumbnail updated at (don't keep updating thumbnails..)
$updatedAt->greaterThan($thumbnailUpdatedAt) &&
// If the route has been updated in the past x minutes...
$updatedAt->addMinute(config('keystoneguru.thumbnail_refresh_min'))->isPast())
$updatedAt->addMinutes(config('keystoneguru.thumbnail_refresh_min'))->isPast())
||
// Update every month regardless
$thumbnailUpdatedAt->addMonth(1)->isPast()
$thumbnailUpdatedAt->addMonth()->isPast()
||
// Thumbnail does not exist in the folder it should
!ProcessRouteFloorThumbnail::thumbnailsExistsForRoute($dungeonRoute)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -29,7 +29,7 @@
}
],
"require": {
"php": ">=5.6.4",
"php": ">=7.4",
"ext-json": "*",
"barryvdh/laravel-ide-helper": "^2.4",
"folklore/image": "0.3.*",
Expand Down
8 changes: 4 additions & 4 deletions config/horizon.php
Expand Up @@ -142,14 +142,14 @@
'production' => [
'supervisor-default' => [
'connection' => 'redis',
'queue' => ['default'],
'queue' => [sprintf('%s-production-default', env('APP_TYPE'))],
'balance' => 'simple',
'processes' => 1,
'tries' => 3,
],
'supervisor-thumbnail' => [
'connection' => 'redis',
'queue' => ['thumbnail'],
'queue' => [sprintf('%s-production-thumbnail', env('APP_TYPE'))],
'balance' => 'simple',
'processes' => 1,
'tries' => 1,
Expand All @@ -159,14 +159,14 @@
'local' => [
'supervisor-default' => [
'connection' => 'redis',
'queue' => ['default'],
'queue' => [sprintf('%s-local-default', env('APP_TYPE'))],
'balance' => 'simple',
'processes' => 1,
'tries' => 3,
],
'supervisor-thumbnail' => [
'connection' => 'redis',
'queue' => ['thumbnail'],
'queue' => [sprintf('%s-local-thumbnail', env('APP_TYPE'))],
'balance' => 'simple',
'processes' => 1,
'tries' => 1,
Expand Down
2 changes: 1 addition & 1 deletion docs/lua.md
Expand Up @@ -2,7 +2,7 @@
So, hopefully I won't have to read this file ever again but here's some pointers about what needs to be done to install LUA on PHP.

## To install LUA and configure it
Run `storage/sh/setup_lua.sh`.
Run `./sh/setup_lua.sh`.

## Lua
```
Expand Down
6 changes: 6 additions & 0 deletions docs/scheduler.md
@@ -0,0 +1,6 @@
# Horizon
Horizon spawns workers which consume jobs. It does NOT generate jobs.

# Scheduler
The Scheduler runs Scheduled Tasks at a specific time. These Tasks can do a bunch of things, but I use to it spawn Jobs.
The Scheduler is triggered from Crontab
2 changes: 1 addition & 1 deletion resources/views/admin/tools/mdt/string.blade.php
Expand Up @@ -10,7 +10,7 @@
{{ Form::open(['route' => $dungeonroute ? 'admin.tools.mdt.string.viewasdungeonroute.submit' : 'admin.tools.mdt.string.submit']) }}
<div class="form-group">
{!! Form::label('import_string', __('Paste your Method Dungeon Tools export string')) !!}
{{ Form::textarea('import_string', '', ['class' => 'form-control']) }}
{{ Form::textarea('import_string', '', ['class' => 'form-control', 'data-simplebar' => '']) }}
</div>
<div class="form-group">
{!! Form::submit(__('Submit'), ['class' => 'btn btn-primary col-md-auto']) !!}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/app.blade.php
Expand Up @@ -439,7 +439,7 @@
</h3>
<div class="form-group">
{!! Form::label('import_string', __('Paste your Method Dungeon Tools export string')) !!}
{{ Form::textarea('import_string_textarea', '', ['class' => 'form-control import_mdt_string_textarea']) }}
{{ Form::textarea('import_string_textarea', '', ['class' => 'form-control import_mdt_string_textarea', 'data-simplebar' => '']) }}
{{ Form::hidden('import_string', '', ['class' => 'import_string']) }}
</div>
<div class="form-group">
Expand Down
6 changes: 4 additions & 2 deletions sh/setup_lua.sh
Expand Up @@ -3,8 +3,10 @@
# Install actual LUA language
sudo apt-get remove liblua5.3
sudo apt-get remove lua5.3
sudo apt-get install lua5.3
sudo apt-get install liblua5.3
sudo apt-get install -y lua5.3 \
liblua5.3 \
unzip \
php-dev

sudo ln -s /usr/include/lua5.3/ /usr/include/lua
sudo cp /usr/lib/x86_64-linux-gnu/liblua5.3.a /usr/lib/liblua.a
Expand Down

0 comments on commit 7c40354

Please sign in to comment.