Skip to content

Commit 5cfd2bf

Browse files
committed
improved docs on voidService [ci skip]
1 parent 551f1e7 commit 5cfd2bf

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

haskell/ngx-export-tools/NgxExport/Tools/Combinators.hs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ voidHandler' = const . voidHandler
100100

101101
-- | A void service which does nothing and returns an empty 'L.ByteString'.
102102
--
103-
-- This can be useful for loading global data from the Nginx configuration in
104-
-- a more concise and declarative way.
103+
-- This can be used for loading global data from the Nginx configuration in a
104+
-- more concise and declarative way.
105105
--
106106
-- For example, if data /Conf/ in
107107
--
@@ -118,6 +118,14 @@ voidHandler' = const . voidHandler
118118
-- can be accessed in the Haskell code via t'Data.IORef.IORef' data storage
119119
-- /storage_Conf_testLoadConf/.
120120
--
121+
-- Declaration 'rareService' is a /persistent/ service mode in terms of module
122+
-- "NgxExport.Tools.SimpleService". This means that if the data storage content
123+
-- gets replaced by /Nothing/ in the code then it will be reset to the original
124+
-- value on the next iteration of the service. Avoid replacing the data storage
125+
-- by /Nothing/. A more natural 'SingleShotService' mode cannot be used for
126+
-- loading global data from the Nginx configuration because it does not
127+
-- maintain data storages.
128+
--
121129
-- Note that /voidService/ is still an /asynchronous/ service which means that
122130
-- the global data it loads may appear uninitialized in very early client
123131
-- requests. To ensure that the data gets loaded before processing client
@@ -134,9 +142,7 @@ voidService = const $ voidHandler' $ return ()
134142
-- | A rare service mode.
135143
--
136144
-- A service that sleeps most of the time. Use this convenient declaration for
137-
-- loading global data from the Nginx configuration with 'voidService'. Services
138-
-- with a more natural 'SingleShotService' strategy do not create storages and
139-
-- thus cannot be used for this purpose.
145+
-- loading global data from the Nginx configuration with 'voidService'.
140146
--
141147
-- @since 1.2.5
142148
rareService :: ServiceMode

0 commit comments

Comments
 (0)