chore(avs): reduce max query numbers further
This commit is contained in:
parent
c31b63fc47
commit
73a62a653b
@ -32,10 +32,10 @@ type AVSGetRampLicences = "RampDrivingLicenceInfo" :> ReqBody '[JSON] AvsQueryG
|
|||||||
type AVSSetRampLicences = "RampDrivingLicence" :> ReqBody '[JSON] AvsQuerySetLicences :> Post '[JSON] AvsResponseSetLicences
|
type AVSSetRampLicences = "RampDrivingLicence" :> ReqBody '[JSON] AvsQuerySetLicences :> Post '[JSON] AvsResponseSetLicences
|
||||||
|
|
||||||
avsMaxSetLicenceAtOnce :: Int
|
avsMaxSetLicenceAtOnce :: Int
|
||||||
avsMaxSetLicenceAtOnce = 90 -- maximum input set size for avsQuerySetLicences as enforced by AVS
|
avsMaxSetLicenceAtOnce = 80 -- maximum input set size for avsQuerySetLicences as enforced by AVS
|
||||||
|
|
||||||
avsMaxQueryAtOnce :: Int
|
avsMaxQueryAtOnce :: Int
|
||||||
avsMaxQueryAtOnce = 900 -- maximum input set size for avsQueryStatus as enforced by AVS
|
avsMaxQueryAtOnce = 500 -- maximum input set size for avsQueryStatus as enforced by AVS
|
||||||
|
|
||||||
|
|
||||||
avsApi :: Proxy AVS
|
avsApi :: Proxy AVS
|
||||||
@ -96,17 +96,18 @@ mkAvsQuery baseUrl basicAuth cliEnv = AvsQuery
|
|||||||
| baseUrl == base = Right $ AvsResponsePerson mempty -- WORKAROUND: AVS server erroneously returns 404 if no matching person could be found in its database!
|
| baseUrl == base = Right $ AvsResponsePerson mempty -- WORKAROUND: AVS server erroneously returns 404 if no matching person could be found in its database!
|
||||||
catch404toEmpty other = other
|
catch404toEmpty other = other
|
||||||
|
|
||||||
splitQuery :: (Wrapped a, Wrapped c, Unwrapped a ~ Set b, Semigroup (Unwrapped c))
|
splitQuery :: (Wrapped a, Wrapped c, Unwrapped a ~ Set b, Semigroup (Unwrapped c))
|
||||||
=> (a -> ClientM c) -> a -> ClientM c
|
=> (a -> ClientM c) -> a -> ClientM c
|
||||||
splitQuery rawQuery q
|
splitQuery rawQuery q
|
||||||
| Set.size s <= avsMaxQueryAtOnce = rawQuery q
|
| avsMaxQueryAtOnce >= Set.size s = rawQuery q
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
let (avsid1, avsid2) = Set.splitAt avsMaxQueryAtOnce s
|
$logInfoS "AVS" $ "Splitting large query for input Set " <> tshow (Set.size s)
|
||||||
res1 <- rawQuery $ view _Unwrapped' avsid1
|
let (avsid1, avsid2) = Set.splitAt avsMaxQueryAtOnce s
|
||||||
res2 <- splitQuery rawQuery $ view _Unwrapped' avsid2
|
res1 <- rawQuery $ view _Unwrapped' avsid1
|
||||||
return $ view _Unwrapped' (res1 ^. _Wrapped' <> res2 ^. _Wrapped')
|
res2 <- splitQuery rawQuery $ view _Unwrapped' avsid2
|
||||||
where
|
return $ view _Unwrapped' (res1 ^. _Wrapped' <> res2 ^. _Wrapped')
|
||||||
s = view _Wrapped' q
|
where
|
||||||
|
s = view _Wrapped' q
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user