From 631de110888a779c95af2f73db67995eba85528e Mon Sep 17 00:00:00 2001 From: "bparodi@lezzo.org" Date: Tue, 3 Dec 2024 11:07:05 +0100 Subject: [PATCH] rename column --- src/DatabaseMigrations.fs | 8 ++++++++ src/Grains.fs | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/DatabaseMigrations.fs b/src/DatabaseMigrations.fs index 3c78d1c..1d6be91 100644 --- a/src/DatabaseMigrations.fs +++ b/src/DatabaseMigrations.fs @@ -205,3 +205,11 @@ type RemoveUselessTables () = override x.Up() = x.Delete.Table "current_jobs" |> ignore + +[] +type RenameCmdInBacklog () = + + inherit OnlyUp () + override x.Up() = + x.Rename.Column("cmd").OnTable("backlog").To("job") + |> ignore diff --git a/src/Grains.fs b/src/Grains.fs index 7bc037d..e72cc85 100644 --- a/src/Grains.fs +++ b/src/Grains.fs @@ -3,6 +3,7 @@ module Bidello.Grains open Orleans open System.Threading open System.Threading.Tasks +open NodaTime open Bidello.Datatypes open Bidello.Shell @@ -13,6 +14,7 @@ type IShellGrain = abstract schedule: CancellationToken -> ChainOfJobs -> ValueTask + type ShellGrain() = inherit Orleans.Grain () @@ -40,7 +42,10 @@ type ShellGrain() = |> Logging.logger.Fatal let rec run_ (hd: CronJob) (tl: CronJob list) = async { + let start_time = SystemClock.Instance.GetCurrentInstant () let! rc = run_job ct hd |> Async.AwaitTask + let end_time = SystemClock.Instance.GetCurrentInstant () + log hd rc match rc, tl with | (Success stdout, hd'::tl')->