Skip to content

Commit 2de287c

Browse files
authored
[NO-ISSUE] Update odd-jobs, pg-transact-effectful and resource-pool (#402)
1 parent cb8e594 commit 2de287c

File tree

9 files changed

+53
-63
lines changed

9 files changed

+53
-63
lines changed

cabal.prof.project

+6-15
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ package *
3232
package warp
3333
flags: -x509
3434

35-
source-repository-package
36-
type: git
37-
location: https://gitlab.com/dpwiz/raven-haskell
38-
tag: 9dacea2bec9c6f5d9f7d46a2a1d9094cf6147fbf
39-
subdir: ./raven-haskell
40-
4135
source-repository-package
4236
type: git
4337
location: https://github.com/supki/envparse
@@ -56,24 +50,21 @@ source-repository-package
5650
location: https://github.com/flora-pm/wai-middleware-heartbeat
5751
tag: 336523a
5852

59-
-- need to use jappeace until this is merged
60-
-- (provides resource-pool 3 support)
61-
-- https://github.com/saurabhnanda/odd-jobs/pull/90
62-
source-repository-package
63-
type: git
64-
location: https://github.com/jappeace/odd-jobs
65-
tag: a75515791f2c743614ec05d54493ef12b143002e
66-
6753
source-repository-package
6854
type: git
6955
location: https://github.com/kleidukos/pg-transact-effectful
70-
tag: 590dd6c
56+
tag: db6fa06
7157

7258
source-repository-package
7359
type: git
7460
location: https://github.com/kleidukos/servant-effectful
7561
tag: 21b5a1d
7662

63+
source-repository-package
64+
type: git
65+
location: https://github.com/saurabhnanda/odd-jobs
66+
tag: 51c7443
67+
7768
source-repository-package
7869
type: git
7970
location: https://github.com/composewell/streamly

cabal.project

+6-15
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ package *
3030
package warp
3131
flags: -x509
3232

33-
source-repository-package
34-
type: git
35-
location: https://gitlab.com/dpwiz/raven-haskell
36-
tag: 9dacea2bec9c6f5d9f7d46a2a1d9094cf6147fbf
37-
subdir: ./raven-haskell
38-
3933
source-repository-package
4034
type: git
4135
location: https://github.com/supki/envparse
@@ -54,24 +48,21 @@ source-repository-package
5448
location: https://github.com/flora-pm/wai-middleware-heartbeat
5549
tag: 336523a
5650

57-
-- need to use jappeace until this is merged
58-
-- (provides resource-pool 3 support)
59-
-- https://github.com/saurabhnanda/odd-jobs/pull/90
60-
source-repository-package
61-
type: git
62-
location: https://github.com/jappeace/odd-jobs
63-
tag: a75515791f2c743614ec05d54493ef12b143002e
64-
6551
source-repository-package
6652
type: git
6753
location: https://github.com/kleidukos/pg-transact-effectful
68-
tag: 98ee27b
54+
tag: db6fa06
6955

7056
source-repository-package
7157
type: git
7258
location: https://github.com/kleidukos/servant-effectful
7359
tag: 21b5a1d
7460

61+
source-repository-package
62+
type: git
63+
location: https://github.com/saurabhnanda/odd-jobs
64+
tag: 51c7443
65+
7566
source-repository-package
7667
type: git
7768
location: https://github.com/composewell/streamly

cabal.project.freeze

+3-4
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ constraints: any.Cabal ==3.8.1.0,
209209
any.network-byte-order ==0.1.6,
210210
any.network-info ==0.2.1,
211211
any.network-uri ==2.6.4.2,
212-
any.odd-jobs ==0.2.2,
212+
any.odd-jobs ==0.2.3,
213213
any.old-locale ==1.0.0.7,
214214
any.old-time ==1.1.0.3,
215215
any.optics-core ==0.4.1,
@@ -222,7 +222,7 @@ constraints: any.Cabal ==3.8.1.0,
222222
any.password-types ==1.0.0.0,
223223
any.pcre2 ==2.2.1,
224224
any.pem ==0.2.4,
225-
any.pg-entity ==0.0.4.2,
225+
any.pg-entity ==0.0.4.3,
226226
pg-entity -book -prod,
227227
any.pg-transact ==0.3.2.0,
228228
any.pg-transact-effectful ==0.0.1.0,
@@ -248,7 +248,7 @@ constraints: any.Cabal ==3.8.1.0,
248248
any.raven-haskell ==0.1.4.1,
249249
any.recv ==0.1.0,
250250
any.regex-applicative ==0.3.4,
251-
any.resource-pool ==0.3.1.0,
251+
any.resource-pool ==0.4.0.0,
252252
any.resourcet ==1.3.0,
253253
any.rts ==1.0.2,
254254
any.safe ==0.3.19,
@@ -371,4 +371,3 @@ constraints: any.Cabal ==3.8.1.0,
371371
any.xml-types ==0.3.8,
372372
any.zlib ==0.6.3.0,
373373
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config
374-
index-state: hackage.haskell.org 2023-06-20T05:12:03Z

flora.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ library
157157
, poolboy
158158
, postgresql-simple
159159
, pretty
160-
, resource-pool >=0.3.1 && <0.4
160+
, resource-pool
161161
, servant-lucid
162162
, servant-server
163163
, slugify

nix/hspkgs.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
});
4747

4848
poolboy = dontCheck (hfinal.callCabal2nix "poolboy" inputs.poolboy { });
49-
resource-pool = hfinal.callHackage "resource-pool" "0.3.1.0" { };
49+
resource-pool = hfinal.callHackage "resource-pool" "0.4.0.0" { };
5050
})

src/core/Flora/Environment.hs

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Colourista.IO (blueMessage)
1414
import Data.ByteString (ByteString)
1515
import Data.Pool (Pool)
1616
import Data.Pool qualified as Pool
17+
import Data.Pool.Introspection (defaultPoolConfig)
1718
import Data.Text
1819
import Data.Text.Encoding qualified as Text
1920
import Data.Time (NominalDiffTime)
@@ -57,12 +58,11 @@ mkPool
5758
mkPool connectionInfo timeout' connections =
5859
liftIO $
5960
Pool.newPool $
60-
Pool.PoolConfig
61-
{ createResource = PG.connectPostgreSQL connectionInfo
62-
, freeResource = PG.close
63-
, poolCacheTTL = realToFrac timeout'
64-
, poolMaxResources = connections
65-
}
61+
defaultPoolConfig
62+
(PG.connectPostgreSQL connectionInfo)
63+
PG.close
64+
(realToFrac timeout')
65+
connections
6666

6767
configToEnv :: (Fail :> es, IOE :> es) => FloraConfig -> Eff es FloraEnv
6868
configToEnv floraConfig = do

src/core/Flora/Import/Categories.hs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Control.Monad.IO.Class
44
import Data.Text.IO qualified as T
55
import Effectful
66
import Effectful.PostgreSQL.Transact.Effect
7+
78
import Flora.Import.Categories.Tuning as Tuning
89
import Flora.Model.Category.Types (Category, mkCategory, mkCategoryId)
910
import Flora.Model.Category.Update (insertCategory)

src/core/Flora/Publish.hs

+14-13
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import Flora.Model.Requirement (Requirement)
2323
{- TODO: Audit log of the published package
2424
TODO: Publish artifacts
2525
-}
26+
2627
publishPackage
2728
:: (DB :> es, Log :> es, Time :> es, IOE :> es)
2829
=> [Requirement]
@@ -32,51 +33,51 @@ publishPackage
3233
-> Package
3334
-> Eff es Package
3435
publishPackage requirements components release userPackageCategories package = do
35-
liftIO $! T.putStrLn $! "[+] Package " <> display (package.name) <> ": "
36-
result <- Query.getPackageByNamespaceAndName (package.namespace) (package.name)
36+
liftIO $! T.putStrLn $! "[+] Package " <> display package.name <> ": "
37+
result <- Query.getPackageByNamespaceAndName package.namespace package.name
3738
case result of
3839
Just existingPackage -> do
39-
liftIO $! T.putStrLn $! "[+] Package " <> display (package.name) <> " already exists."
40+
liftIO $! T.putStrLn $! "[+] Package " <> display package.name <> " already exists."
4041
publishForExistingPackage requirements components release existingPackage
4142
Nothing -> do
42-
liftIO $! T.putStrLn $! "[+] Package " <> display (package.name) <> " does not exist."
43+
liftIO $! T.putStrLn $! "[+] Package " <> display package.name <> " does not exist."
4344
publishForNewPackage requirements components release userPackageCategories package
4445

4546
publishForExistingPackage :: (DB :> es, IOE :> es) => [Requirement] -> [PackageComponent] -> Release -> Package -> Eff es Package
4647
publishForExistingPackage requirements components release package = do
47-
result <- Query.getReleaseByVersion (package.packageId) (release.version)
48+
result <- Query.getReleaseByVersion package.packageId release.version
4849
case result of
4950
Nothing -> do
5051
liftIO $
5152
T.putStrLn $
5253
"[+] Inserting the following components: "
5354
<> display (fmap (.canonicalForm) components)
5455
<> " of "
55-
<> display (package.name)
56+
<> display package.name
5657
<> " v"
57-
<> display (release.version)
58+
<> display release.version
5859
Update.insertRelease release
5960
Update.bulkInsertPackageComponents components
6061
Update.bulkInsertRequirements requirements
6162
Update.refreshDependents
6263
Update.refreshLatestVersions
6364
pure package
6465
Just r -> do
65-
liftIO $! T.putStrLn $! "[+] Release " <> display (package.name) <> " v" <> display (r.version) <> " already exists."
66-
liftIO $! T.putStrLn $! "[+] I am not inserting anything for " <> display (package.name) <> " v" <> display (r.version)
66+
liftIO $! T.putStrLn $! "[+] Release " <> display package.name <> " v" <> display r.version <> " already exists."
67+
liftIO $! T.putStrLn $! "[+] I am not inserting anything for " <> display package.name <> " v" <> display r.version
6768
pure package
6869

6970
publishForNewPackage :: (DB :> es, IOE :> es) => [Requirement] -> [PackageComponent] -> Release -> [UserPackageCategory] -> Package -> Eff es Package
7071
publishForNewPackage requirements components release userPackageCategories package = do
7172
liftIO $! T.putStrLn $! "[+] Normalising user-supplied categories: " <> display userPackageCategories
7273
newCategories <- liftIO $! (.normalisedCategories) <$> Tuning.normalise userPackageCategories
73-
liftIO $! T.putStrLn $! "[+] Inserting package " <> display (package.name)
74+
liftIO $! T.putStrLn $! "[+] Inserting package " <> display package.name
7475
liftIO $
7576
T.putStrLn $
7677
"[+] Inserting the following components: of "
77-
<> display (package.name)
78+
<> display package.name
7879
<> " v"
79-
<> display (release.version)
80+
<> display release.version
8081
<> ": "
8182
<> display (fmap canonicalForm components)
8283
Update.insertPackage package
@@ -86,5 +87,5 @@ publishForNewPackage requirements components release userPackageCategories packa
8687
Update.refreshDependents
8788
Update.refreshLatestVersions
8889
forM_ newCategories $
89-
\(NormalisedPackageCategory categoryName) -> Update.addToCategoryByName (package.packageId) categoryName
90+
\(NormalisedPackageCategory categoryName) -> Update.addToCategoryByName package.packageId categoryName
9091
pure package

test/fixtures/Cabal/flora.cabal

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 3.0
22
name: flora
3-
version: 1.0.9
3+
version: 1.0.12
44
homepage: https://github.com/flora-pm/flora-server/#readme
55
bug-reports: https://github.com/flora-pm/flora-server/issues
66
author: Théophile Choutri
@@ -12,15 +12,15 @@ extra-source-files:
1212
LICENSE
1313
README.md
1414

15-
tested-with: GHC ==9.4.4
15+
tested-with: GHC ==9.4.5
1616

1717
source-repository head
1818
type: git
1919
location: https://github.com/flora-pm/flora-server
2020

2121
flag prod
2222
description:
23-
Compile the project with additional optimisations (takes longer)
23+
Compile the project with additional optimisations (takes longer)
2424

2525
default: False
2626
manual: True
@@ -105,6 +105,7 @@ library
105105
Flora.Model.Package.Query
106106
Flora.Model.Package.Types
107107
Flora.Model.Package.Update
108+
Flora.Model.PackageIndex
108109
Flora.Model.PersistentSession
109110
Flora.Model.Release
110111
Flora.Model.Release.Query
@@ -143,6 +144,7 @@ library
143144
, log-effectful
144145
, lucid
145146
, memory
147+
, monad-time-effectful
146148
, mtl
147149
, odd-jobs
148150
, optics-core
@@ -152,22 +154,25 @@ library
152154
, pg-entity
153155
, pg-transact
154156
, pg-transact-effectful
157+
, poolboy
155158
, postgresql-simple
156159
, pretty
157160
, resource-pool
158161
, servant-lucid
159162
, servant-server
160163
, slugify
161-
, souffle-haskell ==3.4.0
164+
, souffle-haskell ==3.5.1
162165
, streamly
163166
, streamly-core
167+
, tar
164168
, text
165169
, text-display
166170
, time
167-
, time-effectful
171+
, unliftio
168172
, uuid
169173
, vector
170174
, vector-algorithms
175+
, zlib
171176

172177
library flora-web
173178
import: common-extensions
@@ -254,6 +259,7 @@ library flora-web
254259
, lucid-alpine
255260
, lucid-svg
256261
, monad-time
262+
, monad-time-effectful
257263
, mtl
258264
, network-uri
259265
, odd-jobs
@@ -278,7 +284,6 @@ library flora-web
278284
, text
279285
, text-display
280286
, time
281-
, time-effectful
282287
, uuid
283288
, vector
284289
, vector-algorithms
@@ -320,6 +325,7 @@ library flora-jobs
320325
, log-base
321326
, log-effectful
322327
, lucid
328+
, monad-time-effectful
323329
, odd-jobs
324330
, pg-entity
325331
, pg-transact-effectful
@@ -331,7 +337,6 @@ library flora-jobs
331337
, text
332338
, text-display
333339
, time
334-
, time-effectful
335340
, typed-process
336341
, vector
337342

@@ -355,6 +360,7 @@ executable flora-cli
355360
build-depends:
356361
, base
357362
, bytestring
363+
, Cabal-syntax
358364
, effectful-core
359365
, envparse
360366
, flora
@@ -391,6 +397,7 @@ test-suite flora-test
391397
, http-client
392398
, log-base
393399
, log-effectful
400+
, monad-time-effectful
394401
, optics-core
395402
, password
396403
, pg-entity
@@ -406,14 +413,14 @@ test-suite flora-test
406413
, tasty-hunit
407414
, text
408415
, time
409-
, time-effectful
410416
, transformers
411417
, uuid
412418
, vector
413419

414420
other-modules:
415421
Flora.CabalSpec
416422
Flora.CategorySpec
423+
Flora.ImportSpec
417424
Flora.OddJobSpec
418425
Flora.PackageSpec
419426
Flora.TemplateSpec

0 commit comments

Comments
 (0)