Skip to content

Commit

Permalink
Merge pull request #1135 from wireapp/r2020-06-10
Browse files Browse the repository at this point in the history
Release 2020-06-10
  • Loading branch information
fisx authored Jun 10, 2020
2 parents d9ac89c + bf50f9a commit 2da308f
Show file tree
Hide file tree
Showing 125 changed files with 1,207 additions and 1,203 deletions.
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# 2020-06-10

## Release Notes

- schema migration for cassandra_galley
- promote stern *after* galley
- promote spar *after* brig
- no need to upgrade nginz

## New Features

* Validate saml emails (#1113, #1122, #1129)

## Documentation

* Add a note about unused registration flow in docs (#1119)
* Update cassandra-schema.cql (#1127)

## Internal changes

* Fix incomplete pattern in code checking email domain (custom extensions) (#1130)
* Enable additional GHC warnings (#1131)
* Cleanup export list; swagger names. (#1126)

# 2020-06-03

## Release Notes
Expand Down Expand Up @@ -34,7 +58,7 @@
## New Features

* Add tool to migrate data for galley (#1096)
This can be used in a more automated way than the backfill-billing-team-member.
This can be used in a more automated way than the backfill-billing-team-member.
It should be done as a step after deployment.

## Internal Changes
Expand Down
64 changes: 55 additions & 9 deletions docs/reference/cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,48 @@ CREATE TYPE galley_test.pubkey (
pem blob
);

CREATE TABLE galley_test.team_notifications (
team uuid,
id timeuuid,
payload blob,
PRIMARY KEY (team, id)
) WITH CLUSTERING ORDER BY (id ASC)
AND bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE galley_test.team_conv (
team uuid,
conv uuid,
managed boolean,
PRIMARY KEY (team, conv)
) WITH CLUSTERING ORDER BY (conv ASC)
AND bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE galley_test.service (
provider uuid,
id uuid,
Expand All @@ -37,16 +79,17 @@ CREATE TABLE galley_test.service (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE galley_test.team_conv (
team uuid,
conv uuid,
managed boolean,
PRIMARY KEY (team, conv)
) WITH CLUSTERING ORDER BY (conv ASC)
AND bloom_filter_fp_chance = 0.1
CREATE TABLE galley_test.data_migration (
id int,
version int,
date timestamp,
descr text,
PRIMARY KEY (id, version)
) WITH CLUSTERING ORDER BY (version ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
Expand All @@ -61,7 +104,9 @@ CREATE TABLE galley_test.team_conv (
CREATE TABLE galley_test.team_features (
team_id uuid PRIMARY KEY,
legalhold_status int,
sso_status int
search_visibility_status int,
sso_status int,
validate_saml_emails int
) WITH bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
Expand Down Expand Up @@ -242,6 +287,7 @@ CREATE TABLE galley_test.team (
icon text,
icon_key text,
name text,
search_visibility int,
status int
) WITH bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/user/registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ If the code is incorrect or if an incorrect code has been tried enough times, th

## Registration without pre-verification {#RefRegistrationNoPreverification}

_NOTE: This flow is currently not used by any clients. At least this was the state on 2020-05-28_

It is also possible to call `POST /register` without verifying the email address or phone number, in which case the account will have to be activated later by calling [`POST /activate`](activation.md#RefActivationSubmit). Sample API request and response:

```
Expand Down
4 changes: 2 additions & 2 deletions libs/api-bot/api-bot.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: ff48dbfe677cdd01dafb24662f6ef4d5e0dd7f04251cf92a8c7ed61a4787e1c0
-- hash: e2b0b4378fe9c912993ce1a6b0ebd11f8bf68309d63f2dc15a3a1b61c6454461

name: api-bot
version: 0.4.2
Expand Down Expand Up @@ -37,7 +37,7 @@ library
hs-source-dirs:
src
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
build-depends:
HaskellNet >=0.5
, HaskellNet-SSL >=0.3
Expand Down
4 changes: 2 additions & 2 deletions libs/api-client/api-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: c8e4c2db3a7d0e48459ccf411e98bd1cb10b885582f6e005eebe301f3f5390ef
-- hash: 5c9e5b6c9888256963d49396679f85a9923baac2eb58250704bf8223cde92b73

name: api-client
version: 0.4.2
Expand Down Expand Up @@ -36,7 +36,7 @@ library
hs-source-dirs:
src
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
build-depends:
aeson >=0.11
, async >=2.0
Expand Down
4 changes: 2 additions & 2 deletions libs/bilge/bilge.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 3935614b306254149b1649f7970804c8b164d0edfee1b42192edd81220011379
-- hash: 2f6095f5830d420a83db86b6daf3980643bccce908e1ae0439209c41b23708f9

name: bilge
version: 0.22.0
Expand Down Expand Up @@ -35,7 +35,7 @@ library
hs-source-dirs:
src
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
build-depends:
aeson >=0.6
, ansi-terminal >=0.6
Expand Down
6 changes: 3 additions & 3 deletions libs/brig-types/brig-types.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: b7c27bea3301594e838d9d0d39612ad751a4e1e9f52276d6d2fae0c6c3f6ae4a
-- hash: 7497d04521f12339e2a8f5537dacf242839dea9034f69e67f0a254b1548cadd9

name: brig-types
version: 1.35.0
Expand Down Expand Up @@ -45,7 +45,7 @@ library
hs-source-dirs:
src
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path -funbox-strict-fields
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path -funbox-strict-fields
build-depends:
QuickCheck >=2.9
, aeson >=0.11
Expand Down Expand Up @@ -98,7 +98,7 @@ test-suite brig-types-tests
hs-source-dirs:
test/unit
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path -threaded -with-rtsopts=-N
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path -threaded -with-rtsopts=-N
build-depends:
QuickCheck
, aeson
Expand Down
13 changes: 0 additions & 13 deletions libs/brig-types/src/Brig/Types/Instances.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,10 @@ where
import Brig.Types.Client.Prekey
import Brig.Types.Provider
import Brig.Types.Provider.Tag
import Brig.Types.Team.LegalHold
import Cassandra.CQL
import Data.ByteString.Conversion
import Imports

instance Cql LegalHoldStatus where
ctype = Tagged IntColumn

fromCql (CqlInt n) = case n of
0 -> pure $ LegalHoldDisabled
1 -> pure $ LegalHoldEnabled
_ -> fail "fromCql: Invalid LegalHoldStatus"
fromCql _ = fail "fromCql: LegalHoldStatus: CqlInt expected"

toCql LegalHoldDisabled = CqlInt 0
toCql LegalHoldEnabled = CqlInt 1

instance Cql PrekeyId where
ctype = Tagged IntColumn
toCql = CqlInt . fromIntegral . keyId
Expand Down
7 changes: 5 additions & 2 deletions libs/brig-types/src/Brig/Types/Intra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ instance FromJSON UserAccount where

instance ToJSON UserAccount where
toJSON (UserAccount u s) =
let Object o = toJSON u
in Object $ M.insert "status" (toJSON s) o
case toJSON u of
Object o ->
Object $ M.insert "status" (toJSON s) o
other ->
error $ "toJSON UserAccount: not an object: " <> show (encode other)

-------------------------------------------------------------------------------
-- UserList
Expand Down
5 changes: 0 additions & 5 deletions libs/brig-types/src/Brig/Types/Team/LegalHold.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ module Brig.Types.Team.LegalHold
viewLegalHoldService,
LegalHoldClientRequest (..),

-- * LegalHoldTeamConfig (re-export)
LegalHoldTeamConfig (..),
LegalHoldStatus (..),

-- * Other (re-export)
NewLegalHoldService (..),
ViewLegalHoldService (..),
Expand All @@ -52,7 +48,6 @@ import Data.Id
import Data.Json.Util
import Data.Misc
import Imports
import Wire.API.Team.Feature (LegalHoldStatus (..), LegalHoldTeamConfig (..))
import Wire.API.Team.LegalHold
import Wire.API.Team.LegalHold.External (LegalHoldServiceConfirm (..), LegalHoldServiceRemove (..), NewLegalHoldClient (..), RequestNewLegalHoldClient (..))

Expand Down
4 changes: 2 additions & 2 deletions libs/cargohold-types/cargohold-types.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 83ee67ac57c0c2a532f6faa4eae38b3fcc19303fc6d68955ffe4bd98d248e753
-- hash: eff079abe22cc21d655da449bb1d051e145050171695dc58b0333f9d488e3acd

name: cargohold-types
version: 1.5.0
Expand All @@ -27,7 +27,7 @@ library
hs-source-dirs:
src
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
build-depends:
aeson >=0.6
, attoparsec >=0.10
Expand Down
4 changes: 2 additions & 2 deletions libs/cassandra-util/cassandra-util.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 4b6e1302b2f3f0c59820223b656b21aeb8634a3697b272f2546dc957818a3310
-- hash: 9d0b2c673a95e6e12bd1785bc39e04a76d7a961ae31bc856cba5021e8fae9dd2

name: cassandra-util
version: 0.16.5
Expand All @@ -30,7 +30,7 @@ library
hs-source-dirs:
src
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
build-depends:
aeson >=0.7
, base >=4.6 && <5.0
Expand Down
2 changes: 2 additions & 0 deletions libs/cassandra-util/src/Cassandra/Schema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- for ReplicationStrategy
{-# OPTIONS_GHC -Wno-partial-fields #-}

-- This file is part of the Wire Server implementation.
--
Expand Down
4 changes: 2 additions & 2 deletions libs/extended/extended.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 6d1c11d003f9c50397c8bc6ff6b07138dc00200844cb86411aa895fa49ca81f6
-- hash: e55322d0117b6bdd9e66d2fb1768e8c42514125904626540a436a728563609f1

name: extended
version: 0.1.0
Expand All @@ -31,7 +31,7 @@ library
hs-source-dirs:
src
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
build-depends:
aeson
, base
Expand Down
6 changes: 3 additions & 3 deletions libs/federation-util/federation-util.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 312f8e843a350a0a87c70b3b868a3e29f0ec6d30aaa8913ec0a40e33ba30e6bd
-- hash: d327ef72460d5f79332d80fa4a70516b7351472f50c17a8c491d28c65ec0f024

name: federation-util
version: 0.1.0
Expand All @@ -28,7 +28,7 @@ library
hs-source-dirs:
src
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
build-depends:
async >=2.0
, base >=4.6 && <5.0
Expand Down Expand Up @@ -58,7 +58,7 @@ test-suite spec
hs-source-dirs:
test
default-extensions: AllowAmbiguousTypes BangPatterns ConstraintKinds DataKinds DefaultSignatures DerivingStrategies DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable EmptyCase FlexibleContexts FlexibleInstances FunctionalDependencies GADTs InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns NoImplicitPrelude OverloadedStrings PackageImports PatternSynonyms PolyKinds QuasiQuotes RankNTypes ScopedTypeVariables StandaloneDeriving TemplateHaskell TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators UndecidableInstances ViewPatterns
ghc-options: -O2 -Wall -fwarn-tabs -optP-Wno-nonportable-include-path -threaded -rtsopts -with-rtsopts=-N
ghc-options: -O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path -threaded -rtsopts -with-rtsopts=-N
build-depends:
QuickCheck
, async >=2.0
Expand Down
5 changes: 4 additions & 1 deletion libs/federation-util/src/Network/Federation/Util/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ orderSrvResult srvResult = do
randomNumber <- randomRIO (0, total)
-- Select the first record with its running sum greater
-- than or equal to the random number.
let (beginning, ((priority, weight, port, domain, _) : end)) = break (\(_, _, _, _, running) -> randomNumber <= running) sublist'
let (beginning, (priority, weight, port, domain, _), end) =
case break (\(_, _, _, _, running) -> randomNumber <= running) sublist' of
(b, (c : e)) -> (b, c, e)
_ -> error "orderSrvResult: no record with running sum greater than random number"
-- Remove the running total number from the remaining
-- elements.
let sublist'' = map (\(priority', weight', port', domain', _) -> (priority', weight', port', domain')) (concat [beginning, end])
Expand Down
Loading

0 comments on commit 2da308f

Please sign in to comment.