Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Jan 2, 2025
2 parents 39b5bac + d071deb commit d9e08fe
Show file tree
Hide file tree
Showing 35 changed files with 521 additions and 245 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# CHANGELOG

## 1.0.23 -- 2025-01-02

- Record more route duration metrics with prometheus [#810](/~https://github.com/flora-pm/flora-server/pull/810)
- Add prometheus counter for package imports [#811](/~https://github.com/flora-pm/flora-server/pull/811)
- Add new GHC versions [#813](/~https://github.com/flora-pm/flora-server/pull/813)

The following versions have been added:
* 9.12.1
* 9.10.1
* 9.8.4
* 9.8.3
* 9.6.7
* 9.6.6

## 1.0.22 -- 2024-12-27

### Significant changes
Expand Down
16 changes: 15 additions & 1 deletion app/cli/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ import Effectful.FileSystem
import Effectful.Log (Log, runLog)
import Effectful.Poolboy
import Effectful.PostgreSQL.Transact.Effect
import Effectful.Reader.Static (Reader)
import Effectful.Reader.Static qualified as Reader
import Effectful.State.Static.Shared (State)
import Effectful.State.Static.Shared qualified as State
import Effectful.Time (Time, runTime)
import Effectful.Trace (Trace)
import Effectful.Trace qualified as Trace
import GHC.Conc
import GHC.Generics (Generic)
import GHC.Records
import Log qualified
import Log.Backend.StandardOutput qualified as Log
import Monitor.Tracing.Zipkin (Zipkin (..))
Expand All @@ -36,7 +39,8 @@ import System.FilePath ((</>))

import Advisories.Import (importAdvisories)
import Advisories.Import.Error (AdvisoryImportError)
import Flora.Environment
import Flora.Environment (getFloraEnv)
import Flora.Environment.Env
import Flora.Import.Categories (importCategories)
import Flora.Import.Package.Bulk (importAllFilesInRelativeDirectory, importFromIndex)
import Flora.Model.BlobIndex.Update qualified as Update
Expand Down Expand Up @@ -108,6 +112,7 @@ main = Log.withStdOutLogger $ \logger -> do
)
. runFileSystem
. runLog "flora-cli" logger Log.LogTrace
. Reader.runReader env
$ runOptions cliArgs
case result of
Right _ -> pure ()
Expand Down Expand Up @@ -196,6 +201,9 @@ runOptions
, Poolboy :> es
, Error (NonEmpty AdvisoryImportError) :> es
, Trace :> es
, HasField "metrics" r Metrics
, HasField "mltp" r MLTP
, Reader r :> es
)
=> Options
-> Eff es ()
Expand Down Expand Up @@ -245,6 +253,9 @@ importFolderOfCabalFiles
, DB :> es
, IOE :> es
, State (Set (Namespace, PackageName, Version)) :> es
, HasField "metrics" r Metrics
, HasField "mltp" r MLTP
, Reader r :> es
)
=> FilePath
-> Text
Expand All @@ -264,6 +275,9 @@ importIndex
, DB :> es
, IOE :> es
, State (Set (Namespace, PackageName, Version)) :> es
, HasField "metrics" r Metrics
, HasField "mltp" r MLTP
, Reader r :> es
)
=> FilePath
-> Text
Expand Down
21 changes: 6 additions & 15 deletions app/server/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

module Main where

import Control.Monad (forM_, unless, void)
import Control.Monad (forM_, unless)
import Data.Function ((&))
import Data.List qualified as List
import Data.Pool (Pool)
import Data.Set qualified as Set
import Data.Text (Text)
import Data.Text qualified as Text
import Data.Vector (Vector)
import Data.Vector qualified as Vector
import Database.PostgreSQL.Entity
Expand All @@ -24,12 +24,11 @@ import Log qualified
import System.Exit
import System.IO

import Data.Text qualified as Text
import Database.PostgreSQL.Simple qualified as PG
import Flora.Environment (FloraEnv (..), MLTP (..), getFloraEnv)
import Flora.Environment (getFloraEnv)
import Flora.Environment.Env (FloraEnv (..), MLTP (..))
import Flora.Logging qualified as Logging
import Flora.Model.PackageIndex.Types
import FloraJobs.Scheduler (checkIfIndexRefreshJobIsPlanned, scheduleRefreshIndexes)
import FloraJobs.Scheduler (checkIfIndexRefreshJobIsPlanned)
import FloraWeb.Server

main :: IO ()
Expand All @@ -47,17 +46,9 @@ main = do
Log.LogTrace
$ do
checkRepositoriesAreConfigured
checkIndexRefreshScheduling env.pool
checkIfIndexRefreshJobIsPlanned env.pool
runFlora

checkIndexRefreshScheduling :: (DB :> es, Log :> es, IOE :> es) => Pool PG.Connection -> Eff es ()
checkIndexRefreshScheduling pool = do
indexRefreshIsPlanned <-
checkIfIndexRefreshJobIsPlanned
unless indexRefreshIsPlanned $ do
Log.logInfo_ "Scheduling index refresh"
void $ liftIO $ scheduleRefreshIndexes pool

checkRepositoriesAreConfigured :: (DB :> es, Log :> es, IOE :> es) => Eff es ()
checkRepositoriesAreConfigured = do
let expectedRepositories = Set.fromList ["hackage", "cardano", "horizon"]
Expand Down
Loading

0 comments on commit d9e08fe

Please sign in to comment.