-
Notifications
You must be signed in to change notification settings - Fork 0
/
Service.fs
26 lines (24 loc) · 894 Bytes
/
Service.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
namespace FsharpNancyService
open System
open System.Collections.Concurrent
open System.Threading.Tasks
open Microsoft.Extensions.Logging
open Daemon
module Service =
let start (logger:ILogger) (items:Item[]) =
let version = Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion
logger.LogInformation("Staring service {version}", version)
let itemCount = Array.length items
logger.LogInformation("Item count is {Length}", itemCount)
let proceedItem item =
async {
logger.LogTrace("ExecuteForItem {ip}", item.id)
}
let jobs = items |> Array.map (fun item ->
{
action = proceedItem item;
cron = item.cron
})
let daemon = run jobs
logger.LogInformation("Started service")
daemon