1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 16:14:51 +09:00

Add field errorSince to RemoteActor to track inbox POST unreachability

This commit is contained in:
fr33domlover 2019-04-12 01:09:45 +00:00
parent 3f9364e4aa
commit 7946fe441d
5 changed files with 15 additions and 9 deletions

View file

@ -70,9 +70,10 @@ VerifKeySharedUsage
UniqueVerifKeySharedUsage key user
RemoteActor
ident LocalURI
instance InstanceId
inbox LocalURI
ident LocalURI
instance InstanceId
inbox LocalURI
errorSince UTCTime Maybe
UniqueRemoteActor instance ident

View file

@ -384,7 +384,7 @@ handleOutboxNote host (Note mluNote luAttrib aud muParent muContext mpublished c
Right actor -> withHostLock hRecip $ runDB $ do
iid <- either entityKey id <$> insertBy (Instance hRecip)
let luInbox = actorInbox actor
rsid <- either entityKey id <$> insertBy (RemoteActor luRecip iid luInbox)
rsid <- either entityKey id <$> insertBy (RemoteActor luRecip iid luInbox Nothing)
update rdid [RemoteDiscussionActor =. Just rsid, RemoteDiscussionUnlinkedActor =. Nothing]
return $ l2f hRecip luInbox
-- TODO based on the httpPostAP usage in postOutboxR

View file

@ -319,7 +319,7 @@ postOutboxR shr = do
case miid of
Just iid -> return (iid, False)
Nothing -> idAndNew <$> insertBy (Instance h)
let rs = RemoteActor lto iid inbox
let rs = RemoteActor lto iid inbox Nothing
if inew
then insert_ rs
else insertUnique_ rs

View file

@ -238,6 +238,11 @@ changes =
, renameEntity "RemoteSharer" "RemoteActor"
-- 57
, renameUnique "RemoteActor" "UniqueRemoteSharer" "UniqueRemoteActor"
-- 58
, addFieldPrimOptional
"RemoteActor"
(Nothing :: Maybe UTCTime)
"errorSince"
]
migrateDB :: MonadIO m => ReaderT SqlBackend m (Either Text (Int, Int))

View file

@ -135,7 +135,7 @@ instanceAndActor
-> YesodDB site (InstanceId, RemoteActorId, Maybe Bool)
instanceAndActor host luActor luInbox = do
(iid, inew) <- idAndNew <$> insertBy (Instance host)
let rs = RemoteActor luActor iid luInbox
let rs = RemoteActor luActor iid luInbox Nothing
if inew
then do
rsid <- insert rs
@ -329,7 +329,7 @@ keyListedByActorShared iid vkid host luKey luActor = do
RoomModeInstant -> do
when reject $ throwE "Actor key storage limit is 0 and set to reject"
luInbox <- actorInbox <$> ExceptT (keyListedByActor manager host luKey luActor)
lift $ runDB $ either entityKey id <$> insertBy (RemoteActor luActor iid luInbox)
lift $ runDB $ either entityKey id <$> insertBy (RemoteActor luActor iid luInbox Nothing)
RoomModeCached m -> do
eresult <- do
ments <- lift $ runDB $ do
@ -352,7 +352,7 @@ keyListedByActorShared iid vkid host luKey luActor = do
vkExists <- isJust <$> get vkid
case mrsid of
Nothing -> do
rsid <- insert $ RemoteActor luActor iid luInbox
rsid <- insert $ RemoteActor luActor iid luInbox Nothing
when vkExists $ insert_ $ VerifKeySharedUsage vkid rsid
return $ Right rsid
Just rsid -> runExceptT $ do
@ -464,7 +464,7 @@ actorFetchShareSettings = ResultShareSettings
manager <- getsYesod getHttpManager
eactor <- fetchAPID manager actorId h lu
for eactor $ \ actor -> runDB $
insertEntity $ RemoteActor lu iid (actorInbox actor)
insertEntity $ RemoteActor lu iid (actorInbox actor) Nothing
}
fetchRemoteActor