Skip to content

Commit

Permalink
Merge pull request #371 from czqoocavatsim/JoshuaBranch
Browse files Browse the repository at this point in the history
Move Updates to server-log
  • Loading branch information
JoshuaMicallefYBSU authored Oct 20, 2024
2 parents d45138b + 6c06f2e commit 2826e9b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 173 deletions.
41 changes: 2 additions & 39 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ protected function schedule(Schedule $schedule)
//Inactivity checks
$schedule->job(new ProcessRosterInactivity())->daily();

// Monthly Statistics Breakdown
$schedule->job(new ProcessMonthlyBreakdown())->monthlyOn(1, '00:01');

//Solo cert expiry warning
// $schedule->job(new ProcessSoloCertExpiryWarnings())->daily();

// Shanwick Controller Roster Update
$schedule->job(new ProcessShanwickController())->daily();

Expand All @@ -63,39 +57,8 @@ protected function schedule(Schedule $schedule)
// Check Training Threads Status (Once per week)
$schedule->job(new DiscordTrainingWeeklyUpdates())->weeklyOn(6, '00:01');

//CRONS FOR INACTIVITY EMAILS 2 weeks
// $schedule->call(function () {
// //Loop through controllers
// $count = 0;
// foreach (RosterMember::all() as $rosterMember) {
// //Do they meet the requirements?
// if (!$rosterMember->meetsActivityRequirement()) {
// $count++;
// $rosterMember->user->notify(new TwoWeekInactivityReminder($rosterMember, 'n/a'));
// }
// }

// //Tell Discord all about it
// $discord = new DiscordClient();
// $discord->sendMessage(753086414811562014, 'Sent '.$count.' two-week warning inactivity emails');
// })->cron('00 00 16 MAR,JUN,SEP,DEC *'); // 2 weeks before end of quarter

// 1 week
// $schedule->call(function () {
// //Loop through controllers
// $count = 0;
// foreach (RosterMember::all() as $rosterMember) {
// //Do they meet the requirements?
// if (!$rosterMember->meetsActivityRequirement()) {
// $count++;
// $rosterMember->user->notify(new OneWeekInactivityReminder($rosterMember, 'n/a'));
// }
// }

// //Tell Discord all about it
// $discord = new DiscordClient();
// $discord->sendMessage(753086414811562014, 'Sent '.$count.' one-week warning inactivity emails');
// })->cron('00 00 23 MAR,JUN,SEP,DEC *'); // 1 week before end of quarter*/
// Monthly Statistics Breakdown
$schedule->job(new ProcessMonthlyBreakdown())->monthlyOn(1, '00:01');
}

/**
Expand Down
8 changes: 4 additions & 4 deletions app/Jobs/DiscordAccountCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DiscordAccountCheck implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

public $timeout = 5000;
public $timeout = 7200;

/**
* Execute the job.
Expand All @@ -34,7 +34,7 @@ class DiscordAccountCheck implements ShouldQueue
public function handle()
{
// Timeout length (seconds)
ini_set('max_execution_time', 5000);
ini_set('max_execution_time', 7200);

// Script Start Time
$start_time = Carbon::now();
Expand Down Expand Up @@ -73,7 +73,7 @@ public function handle()
}

// Add a Sleep Timer - Allows API to not block
sleep(2);
sleep(3);

// Check if user is currently in Discord
if (in_array($user->discord_user_id, $discord_uids)) {
Expand Down Expand Up @@ -237,7 +237,7 @@ public function handle()
$update_content .= "\n- Script Time: " . $start_time->diffForHumans($end_time, ['parts' => 2, 'short' => true, 'syntax' => Carbon::DIFF_ABSOLUTE]) . ".";


$discord->sendMessageWithEmbed(env('DISCORD_WEB_LOGS'), 'DAILY: Discord User Update', $update_content);
$discord->sendMessageWithEmbed(env('DISCORD_SERVER_LOGS'), 'DAILY: Discord User Update', $update_content);
}

}
2 changes: 1 addition & 1 deletion app/Jobs/DiscordTrainingWeeklyUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public function handle()
}

// Send Message
$discord->sendMessageWithEmbed(env('DISCORD_WEB_LOGS'), 'WEEKLY: Discord Training Thread Updates', $update_content);
$discord->sendMessageWithEmbed(env('DISCORD_SERVER_LOGS'), 'WEEKLY: Discord Training Thread Updates', $update_content);
}
}
}
2 changes: 1 addition & 1 deletion app/Jobs/ProcessRosterInactivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function handle()
// Send Web Notification if any changes have been made
if($first_notice != 0 || $second_notice !== 0 || $third_notice !== 0 || $termination_notice !== 0){
$discord = new DiscordClient();
$discord->sendMessageWithEmbed(env('DISCORD_WEB_LOGS'), 'AUTO: Roster Inactivity Update',
$discord->sendMessageWithEmbed(env('DISCORD_SERVER_LOGS'), 'AUTO: Roster Inactivity Update',
'The Following changes have occured to the Controller Roster
60 Days till Removed: '.$first_notice.'
30 Days till Removed: '.$second_notice.'
Expand Down
4 changes: 2 additions & 2 deletions app/Jobs/ProcessShanwickController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ProcessShanwickController implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

public $timeout = 300;
public $timeout = 600;

/**
* Create a new job instance.
Expand All @@ -39,7 +39,7 @@ public function __construct()
public function handle()
{
// Data to Start Off With
ini_set('max_execution_time', 300);
ini_set('max_execution_time', 600);

// VATSIM Region List
$vatsim_regions = [
Expand Down
126 changes: 0 additions & 126 deletions app/Jobs/UpdateDiscordUserRoles.php

This file was deleted.

0 comments on commit 2826e9b

Please sign in to comment.