feat(users/Profpatsch/whatcd-resolver): add autorefresh

Adds a little polling mechanism that compares against an ID that is
generated anew every time the server is restarted.

Works well together with shortcuttable.

Change-Id: Icc6745b599e43881c14349794feaf5794cfe6777
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11172
Autosubmit: Profpatsch <mail@profpatsch.de>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
This commit is contained in:
Profpatsch 2024-03-17 02:26:47 +01:00 committed by clbot
parent efa5fe1239
commit 3b9fb1aa60
4 changed files with 82 additions and 9 deletions

View file

@ -164,6 +164,21 @@ querySingleRow ::
querySingleRow qry params = do
query qry params >>= ensureSingleRow
-- TODO: implement via fold, so that the result doesnt have to be realized in memory
querySingleRowWith ::
( MonadPostgres m,
ToRow qParams,
Typeable qParams,
Typeable a,
MonadThrow m
) =>
Query ->
qParams ->
Decoder a ->
Transaction m a
querySingleRowWith qry params decoder = do
queryWith qry params decoder >>= ensureSingleRow
-- TODO: implement via fold, so that the result doesnt have to be realized in memory
querySingleRowMaybe ::
( MonadPostgres m,