fix: use finished_at for the end time instead of created_at
This commit is contained in:
parent
48b10de4f3
commit
30f36f96db
11 changed files with 66 additions and 31 deletions
|
|
@ -317,7 +317,7 @@ public function handle(): void
|
|||
throw $e;
|
||||
} finally {
|
||||
$this->application_deployment_queue->update([
|
||||
'finished_at' => now(),
|
||||
'finished_at' => Carbon::now()->toImmutable(),
|
||||
]);
|
||||
|
||||
if ($this->use_build_server) {
|
||||
|
|
|
|||
|
|
@ -331,6 +331,11 @@ public function handle(): void
|
|||
if ($this->team) {
|
||||
BackupCreated::dispatch($this->team->id);
|
||||
}
|
||||
if ($this->backup_log) {
|
||||
$this->backup_log->update([
|
||||
'finished_at' => Carbon::now()->toImmutable(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
use App\Models\Server;
|
||||
use App\Notifications\Server\DockerCleanupFailed;
|
||||
use App\Notifications\Server\DockerCleanupSuccess;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
|
@ -119,6 +120,12 @@ public function handle(): void
|
|||
}
|
||||
$this->server->team?->notify(new DockerCleanupFailed($this->server, 'Docker cleanup job failed with the following error: '.$e->getMessage()));
|
||||
throw $e;
|
||||
} finally {
|
||||
if ($this->execution_log) {
|
||||
$this->execution_log->update([
|
||||
'finished_at' => Carbon::now()->toImmutable(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
use App\Models\Team;
|
||||
use App\Notifications\ScheduledTask\TaskFailed;
|
||||
use App\Notifications\ScheduledTask\TaskSuccess;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
|
@ -131,6 +132,11 @@ public function handle(): void
|
|||
throw $e;
|
||||
} finally {
|
||||
ScheduledTaskDone::dispatch($this->team->id);
|
||||
if ($this->task_log) {
|
||||
$this->task_log->update([
|
||||
'finished_at' => Carbon::now()->toImmutable(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public function up(): void
|
|||
$table->json('cleanup_log')->nullable();
|
||||
$table->foreignId('server_id');
|
||||
$table->timestamps();
|
||||
$table->timestamp('finished_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('application_deployment_queues', function (Blueprint $table) {
|
||||
$table->timestamp('finished_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('application_deployment_queues', function (Blueprint $table) {
|
||||
$table->dropColumn('finished_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('application_deployment_queues', function (Blueprint $table) {
|
||||
$table->timestamp('finished_at')->nullable();
|
||||
});
|
||||
Schema::table('scheduled_database_backup_executions', function (Blueprint $table) {
|
||||
$table->timestamp('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('scheduled_task_executions', function (Blueprint $table) {
|
||||
$table->timestamp('finished_at')->nullable();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('application_deployment_queues', function (Blueprint $table) {
|
||||
$table->dropColumn('finished_at');
|
||||
});
|
||||
|
||||
Schema::table('scheduled_database_backup_executions', function (Blueprint $table) {
|
||||
$table->dropColumn('finished_at');
|
||||
});
|
||||
|
||||
Schema::table('scheduled_task_executions', function (Blueprint $table) {
|
||||
$table->dropColumn('finished_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -66,8 +66,8 @@ class="block">
|
|||
<div class="text-gray-600 dark:text-gray-400 text-sm">
|
||||
Started: {{ formatDateInServerTimezone(data_get($deployment, 'created_at'), data_get($application, 'destination.server')) }}
|
||||
@if($deployment->status !== 'in_progress')
|
||||
<br>Ended: {{ formatDateInServerTimezone(data_get($deployment, 'updated_at'), data_get($application, 'destination.server')) }}
|
||||
<br>Duration: {{ calculateDuration(data_get($deployment, 'created_at'), data_get($deployment, 'updated_at')) }}
|
||||
<br>Ended: {{ formatDateInServerTimezone(data_get($deployment, 'finished_at'), data_get($application, 'destination.server')) }}
|
||||
<br>Duration: {{ calculateDuration(data_get($deployment, 'created_at'), data_get($deployment, 'finished_at')) }}
|
||||
@else
|
||||
<br>Running for: {{ calculateDuration(data_get($deployment, 'created_at'), now()) }}
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@
|
|||
<div class="text-gray-600 dark:text-gray-400 text-sm">
|
||||
Started: {{ formatDateInServerTimezone(data_get($execution, 'created_at'), $this->server()) }}
|
||||
@if(data_get($execution, 'status') !== 'running')
|
||||
<br>Ended: {{ formatDateInServerTimezone(data_get($execution, 'updated_at'), $this->server()) }}
|
||||
<br>Duration: {{ calculateDuration(data_get($execution, 'created_at'), data_get($execution, 'updated_at')) }}
|
||||
<br>Ended: {{ formatDateInServerTimezone(data_get($execution, 'finished_at'), $this->server()) }}
|
||||
<br>Duration: {{ calculateDuration(data_get($execution, 'created_at'), data_get($execution, 'finished_at')) }}
|
||||
@endif
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 text-sm">
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@
|
|||
<div class="text-gray-600 dark:text-gray-400 text-sm">
|
||||
Started: {{ formatDateInServerTimezone(data_get($execution, 'created_at', now()), data_get($task, 'application.destination.server') ?? data_get($task, 'service.destination.server')) }}
|
||||
@if(data_get($execution, 'status') !== 'running')
|
||||
<br>Ended: {{ formatDateInServerTimezone(data_get($execution, 'updated_at'), data_get($task, 'application.destination.server') ?? data_get($task, 'service.destination.server')) }}
|
||||
<br>Duration: {{ calculateDuration(data_get($execution, 'created_at'), data_get($execution, 'updated_at')) }}
|
||||
<br>Ended: {{ formatDateInServerTimezone(data_get($execution, 'finished_at'), data_get($task, 'application.destination.server') ?? data_get($task, 'service.destination.server')) }}
|
||||
<br>Duration: {{ calculateDuration(data_get($execution, 'created_at'), data_get($execution, 'finished_at')) }}
|
||||
@endif
|
||||
</div>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@
|
|||
<div class="text-gray-600 dark:text-gray-400 text-sm">
|
||||
Started: {{ formatDateInServerTimezone(data_get($execution, 'created_at', now()), $server) }}
|
||||
@if(data_get($execution, 'status') !== 'running')
|
||||
<br>Ended: {{ formatDateInServerTimezone(data_get($execution, 'updated_at'), $server) }}
|
||||
<br>Duration: {{ calculateDuration(data_get($execution, 'created_at'), data_get($execution, 'updated_at')) }}
|
||||
<br>Ended: {{ formatDateInServerTimezone(data_get($execution, 'finished_at'), $server) }}
|
||||
<br>Duration: {{ calculateDuration(data_get($execution, 'created_at'), data_get($execution, 'finished_at')) }}
|
||||
@endif
|
||||
</div>
|
||||
</a>
|
||||
|
|
|
|||
Loading…
Reference in a new issue