ngx-export-tools-1.2.4: Extra tools for Nginx Haskell module
Copyright(c) Alexey Radkov 2018-2023
LicenseBSD-style
Maintaineralexey.radkov@gmail.com
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

NgxExport.Tools.SplitService

Description

 
Synopsis

Split services

Split services split the whole service into two separate actions for the first (ignition service) and the following (deferred service) runs.

Exported functions

splitService Source #

Arguments

:: (a -> IO ByteString)

Ignition service

-> (a -> IO ByteString)

Deferred service

-> a

Configuration

-> NgxExportService 

Sets two different actions as ignition and deferred services.

When used as a single-shot service (in terms of module NgxExport.Tools.SimpleService), the second action only runs on exit of a worker process, and therefore can be used as a cleanup handler.

ignitionService Source #

Arguments

:: (a -> IO ByteString)

Ignition service

-> a

Configuration

-> NgxExportService 

Sets an action as an ignition service.

deferredService Source #

Arguments

:: (a -> IO ByteString)

Deferred service

-> a

Configuration

-> NgxExportService 

Sets an action as a deferred service.

When used as a single-shot service (in terms of module NgxExport.Tools.SimpleService), the action only runs on exit of a worker process, and therefore can be used as a cleanup handler.

Type declarations

type NgxExportService Source #

Arguments

 = Bool

First-run flag

-> IO ByteString 

Allows writing fancier declarations of services.

For example, service signalUpconf in

type Upconf = [Text]

signalUpconf :: Upconf -> Bool -> IO ByteString
signalUpconf = voidHandler' . mapConcurrently_ getUrl

ngxExportSimpleServiceTyped 'signalUpconf ''Upconf $
    PersistentService Nothing

can be rewritten in a fancier way:

signalUpconf :: Upconf -> NgxExportService
signalUpconf = voidHandler' . mapConcurrently_ getUrl

Since: 1.2.2