aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account-follow.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-30 11:31:15 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-30 11:31:15 +0100
commit25ed141c7c7631ef21d8764c1163fbf8a6591391 (patch)
tree8f556181a3369e7e4938d612d91be0af813e5067 /server/models/account/account-follow.ts
parent5cd80545422bba855cc9a730a2e13cc9d982c34b (diff)
downloadPeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.tar.gz
PeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.tar.zst
PeerTube-25ed141c7c7631ef21d8764c1163fbf8a6591391.zip
Put activity pub sends inside transactions
Diffstat (limited to 'server/models/account/account-follow.ts')
-rw-r--r--server/models/account/account-follow.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/server/models/account/account-follow.ts b/server/models/account/account-follow.ts
index 8e35c7d20..724f37baa 100644
--- a/server/models/account/account-follow.ts
+++ b/server/models/account/account-follow.ts
@@ -181,16 +181,16 @@ listFollowersForApi = function (id: number, start: number, count: number, sort:
181 }) 181 })
182} 182}
183 183
184listAcceptedFollowerUrlsForApi = function (accountIds: number[], start?: number, count?: number) { 184listAcceptedFollowerUrlsForApi = function (accountIds: number[], t: Sequelize.Transaction, start?: number, count?: number) {
185 return createListAcceptedFollowForApiQuery('followers', accountIds, start, count) 185 return createListAcceptedFollowForApiQuery('followers', accountIds, t, start, count)
186} 186}
187 187
188listAcceptedFollowerSharedInboxUrls = function (accountIds: number[]) { 188listAcceptedFollowerSharedInboxUrls = function (accountIds: number[], t: Sequelize.Transaction) {
189 return createListAcceptedFollowForApiQuery('followers', accountIds, undefined, undefined, 'sharedInboxUrl') 189 return createListAcceptedFollowForApiQuery('followers', accountIds, t, undefined, undefined, 'sharedInboxUrl')
190} 190}
191 191
192listAcceptedFollowingUrlsForApi = function (accountIds: number[], start?: number, count?: number) { 192listAcceptedFollowingUrlsForApi = function (accountIds: number[], t: Sequelize.Transaction, start?: number, count?: number) {
193 return createListAcceptedFollowForApiQuery('following', accountIds, start, count) 193 return createListAcceptedFollowForApiQuery('following', accountIds, t, start, count)
194} 194}
195 195
196// ------------------------------ UTILS ------------------------------ 196// ------------------------------ UTILS ------------------------------
@@ -198,6 +198,7 @@ listAcceptedFollowingUrlsForApi = function (accountIds: number[], start?: number
198async function createListAcceptedFollowForApiQuery ( 198async function createListAcceptedFollowForApiQuery (
199 type: 'followers' | 'following', 199 type: 'followers' | 'following',
200 accountIds: number[], 200 accountIds: number[],
201 t: Sequelize.Transaction,
201 start?: number, 202 start?: number,
202 count?: number, 203 count?: number,
203 columnUrl = 'url' 204 columnUrl = 'url'
@@ -227,7 +228,8 @@ async function createListAcceptedFollowForApiQuery (
227 228
228 const options = { 229 const options = {
229 bind: { accountIds }, 230 bind: { accountIds },
230 type: Sequelize.QueryTypes.SELECT 231 type: Sequelize.QueryTypes.SELECT,
232 transaction: t
231 } 233 }
232 tasks.push(AccountFollow['sequelize'].query(query, options)) 234 tasks.push(AccountFollow['sequelize'].query(query, options))
233 } 235 }