Skip to content

Commit

Permalink
increase function timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
OronNadiv committed Sep 4, 2024
1 parent 6e3817b commit 4d8fc5a
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const stripeImpl = Stripe(admin, {
const users2Contacts = Users2Contacts(admin)
const updateEvents = UpdateEvents(admin, app_id, city_id)

const AUTH_2_USERS_TIMEOUT_IN_SECONDS = 180
const ITERATION_ON_ACCOUNTS_TIMEOUT_IN_SECONDS = 180

const auth2UsersExec = (options: Auth2UsersOptions) => async () => {
try {
Expand All @@ -58,20 +58,26 @@ const auth2UsersExec = (options: Auth2UsersOptions) => async () => {
}
}

export const purgeUsersUnder13CronJob = functions.pubsub
export const purgeUsersUnder13CronJob = functions
.runWith({ timeoutSeconds: ITERATION_ON_ACCOUNTS_TIMEOUT_IN_SECONDS })
.pubsub
.schedule('10 */6 * * *')
.onRun(async () => await purgeUsersUnder13())

export const auth2UsersCronJob = functions
.runWith({ timeoutSeconds: AUTH_2_USERS_TIMEOUT_IN_SECONDS })
.runWith({ timeoutSeconds: ITERATION_ON_ACCOUNTS_TIMEOUT_IN_SECONDS })
.pubsub
.schedule('20 */6 * * *')
.onRun(async () => await auth2UsersExec({ syncGravatar: true }))

export const auth2UsersOnCreate = functions
.runWith({ timeoutSeconds: AUTH_2_USERS_TIMEOUT_IN_SECONDS })
.runWith({ timeoutSeconds: ITERATION_ON_ACCOUNTS_TIMEOUT_IN_SECONDS })
.auth
.user().onCreate(auth2UsersExec({ syncGravatar: false }))

export const users2ContactsCronJob = functions.pubsub
export const users2ContactsCronJob = functions
.runWith({ timeoutSeconds: ITERATION_ON_ACCOUNTS_TIMEOUT_IN_SECONDS })
.pubsub
.schedule('30 */6 * * *')
.onRun(async () => {
try {
Expand All @@ -83,7 +89,7 @@ export const users2ContactsCronJob = functions.pubsub
})

export const contacts2MailChimpCronJob = functions
.runWith({ timeoutSeconds: 180 })
.runWith({ timeoutSeconds: ITERATION_ON_ACCOUNTS_TIMEOUT_IN_SECONDS })
.pubsub.schedule('40 */6 * * *')
.onRun(async () => {
try {
Expand Down Expand Up @@ -182,6 +188,8 @@ export const deleteUser = functions
await deleteUserImpl({ uid: targetUID, email: targetEmail })
})

export const sendMembershipRemindersCronJob = functions.pubsub
export const sendMembershipRemindersCronJob = functions
.runWith({ timeoutSeconds: ITERATION_ON_ACCOUNTS_TIMEOUT_IN_SECONDS })
.pubsub
.schedule('0 19 * * *')
.onRun(async () => await sendMembershipReminders())

0 comments on commit 4d8fc5a

Please sign in to comment.