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:
parent
7c2fad7417
commit
b0da8747a2
1 changed files with 3 additions and 3 deletions
|
@ -451,8 +451,7 @@ addVerifKey h uinb vkd =
|
||||||
|
|
||||||
actorFetchShareSettings
|
actorFetchShareSettings
|
||||||
:: ( YesodPersist site
|
:: ( YesodPersist site
|
||||||
, PersistUniqueRead (YesodPersistBackend site)
|
, PersistUniqueWrite (YesodPersistBackend site)
|
||||||
, PersistStoreWrite (YesodPersistBackend site)
|
|
||||||
, BaseBackend (YesodPersistBackend site) ~ SqlBackend
|
, BaseBackend (YesodPersistBackend site) ~ SqlBackend
|
||||||
, HasHttpManager site
|
, HasHttpManager site
|
||||||
)
|
)
|
||||||
|
@ -468,7 +467,8 @@ actorFetchShareSettings = ResultShareSettings
|
||||||
manager <- getsYesod getHttpManager
|
manager <- getsYesod getHttpManager
|
||||||
eactor <- fetchAPID' manager actorId h lu
|
eactor <- fetchAPID' manager actorId h lu
|
||||||
for eactor $ \ actor -> runDB $
|
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
|
fetchRemoteActor
|
||||||
|
|
Loading…
Reference in a new issue