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

In ActorFetchShare, use insertBy' to allow non-shared insertions

Before this patch, the shared fetch used plain insert, because it relied on
being the only place in the codebase where new RemoteActors get inserted. I was
hoping for that to be the case, but while I tweak things and handle fetching
URIs that can be an actor or a public key (for which ActorFetchShare isn't
sufficient without some smart modification), I'd like concurrent insertions to
be safe, without getting in the way of ActorFetchShare.

With this patch, it now uses insertBy', which doesn't mind concurrent
insertions.
This commit is contained in:
fr33domlover 2019-04-16 16:33:08 +00:00
parent 7c2fad7417
commit b0da8747a2

View file

@ -451,8 +451,7 @@ addVerifKey h uinb vkd =
actorFetchShareSettings
:: ( YesodPersist site
, PersistUniqueRead (YesodPersistBackend site)
, PersistStoreWrite (YesodPersistBackend site)
, PersistUniqueWrite (YesodPersistBackend site)
, BaseBackend (YesodPersistBackend site) ~ SqlBackend
, HasHttpManager site
)
@ -468,7 +467,8 @@ actorFetchShareSettings = ResultShareSettings
manager <- getsYesod getHttpManager
eactor <- fetchAPID' manager actorId h lu
for eactor $ \ actor -> runDB $
insertEntity $ RemoteActor lu iid (actorInbox actor) Nothing
let ra = RemoteActor lu iid (actorInbox actor) Nothing
in either id (flip Entity ra) <$> insertBy' ra
}
fetchRemoteActor