1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-29 00:54:52 +09:00

Add setting that says how much time to keep retrying activity delivery

This commit is contained in:
fr33domlover 2019-04-01 23:38:44 +00:00
parent a3bd0356e2
commit 0c280c7af6
2 changed files with 22 additions and 3 deletions

View file

@ -131,7 +131,6 @@ max-accounts: 3
# Federation # Federation
############################################################################### ###############################################################################
# Whether to support federation. This includes: # Whether to support federation. This includes:
# #
# * Accept activities from other servers in the inbox # * Accept activities from other servers in the inbox
@ -148,3 +147,11 @@ hashids-salt-file: config/hashids_salt
# Whether to reject an HTTP signature when we want to insert a new key or usage # Whether to reject an HTTP signature when we want to insert a new key or usage
# record but reached the limit setting # record but reached the limit setting
reject-on-max-keys: true reject-on-max-keys: true
# The duration of time during which a remote actor is unreachable and we
# periodically retry to deliver them activities. After that period of time, we
# stop trying to deliver and we remove them from follower lists of local
# actors.
drop-delivery-after:
amount: 25
unit: weeks

View file

@ -31,8 +31,10 @@ import Control.Exception (throw)
import Data.Aeson (Result (..), fromJSON, withObject, (.!=), import Data.Aeson (Result (..), fromJSON, withObject, (.!=),
(.:?)) (.:?))
import Data.FileEmbed (embedFile) import Data.FileEmbed (embedFile)
import Data.Time.Interval (TimeInterval) import Data.Time.Clock
import Data.Time.Interval.Aeson (interval) import Data.Time.Interval
import Data.Time.Interval.Aeson
import Data.Time.Units
import Data.Yaml (decodeEither') import Data.Yaml (decodeEither')
import Database.Persist.Postgresql (PostgresConf) import Database.Persist.Postgresql (PostgresConf)
import Language.Haskell.TH.Syntax (Exp, Name, Q) import Language.Haskell.TH.Syntax (Exp, Name, Q)
@ -139,6 +141,11 @@ data AppSettings = AppSettings
-- over HTTP, which possibly means we have to do more HTTP key fetching, -- over HTTP, which possibly means we have to do more HTTP key fetching,
-- and the target server gets a higher load of key fetch GET requests. -- and the target server gets a higher load of key fetch GET requests.
, appRejectOnMaxKeys :: Bool , appRejectOnMaxKeys :: Bool
-- | The duration of time during which a remote actor is unreachable and
-- we periodically retry to deliver them activities. After that period of
-- time, we stop trying to deliver and we remove them from follower lists
-- of local actors.
, appDropDeliveryAfter :: NominalDiffTime
} }
instance FromJSON AppSettings where instance FromJSON AppSettings where
@ -185,8 +192,13 @@ instance FromJSON AppSettings where
appCapabilitySigningKeyFile <- o .: "capability-signing-key" appCapabilitySigningKeyFile <- o .: "capability-signing-key"
appHashidsSaltFile <- o .: "hashids-salt-file" appHashidsSaltFile <- o .: "hashids-salt-file"
appRejectOnMaxKeys <- o .: "reject-on-max-keys" appRejectOnMaxKeys <- o .: "reject-on-max-keys"
appDropDeliveryAfter <- ndt <$> o .: "drop-delivery-after"
return AppSettings {..} return AppSettings {..}
where
toSeconds :: TimeInterval -> Second
toSeconds = toTimeUnit
ndt = fromIntegral . toSeconds . interval
-- | Settings for 'widgetFile', such as which template languages to support and -- | Settings for 'widgetFile', such as which template languages to support and
-- default Hamlet settings. -- default Hamlet settings.