Make backup throttling configurable
This commit is contained in:
parent
a7fef8b736
commit
794cf9d9dd
3 changed files with 23 additions and 9 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Reference in a new issue