Make backup throttling configurable

This commit is contained in:
Dane Everitt 2020-12-27 16:41:53 -08:00
parent a7fef8b736
commit 794cf9d9dd
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 23 additions and 9 deletions

View file

@ -19,16 +19,16 @@ class BackupRepository extends EloquentRepository
* Determines if too many backups have been generated by the server.
*
* @param int $server
* @param int $minutes
* @param int $seconds
* @return \Pterodactyl\Models\Backup[]|\Illuminate\Support\Collection
*/
public function getBackupsGeneratedDuringTimespan(int $server, int $minutes = 10)
public function getBackupsGeneratedDuringTimespan(int $server, int $seconds = 600)
{
return $this->getBuilder()
->withTrashed()
->where('server_id', $server)
->where('is_successful', true)
->where('created_at', '>=', Carbon::now()->subMinutes($minutes)->toDateTimeString())
->where('created_at', '>=', Carbon::now()->subSeconds($seconds)->toDateTimeString())
->get()
->toBase();
}