Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Firebase/functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Firebase/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"axios": "^1.9.0",
"dotenv": "^16.5.0",
"firebase-admin": "^12.6.0",
"firebase-functions": "^7.0.5",
"firebase-functions": "^7.2.2",
"jsonwebtoken": "^9.0.2"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions Firebase/functions/src/auth/apple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function getAppleConfiguration() {

export const requestAppleCustomToken = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: "asia-northeast3",
}, async (request) => {
try {
Expand Down Expand Up @@ -142,7 +142,7 @@ export const requestAppleCustomToken = onCall({

export const requestAppleRefreshToken = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: "asia-northeast3",
}, async (request) => {
if (!request.auth) {
Expand Down Expand Up @@ -186,7 +186,7 @@ export const requestAppleRefreshToken = onCall({

export const refreshAppleAccessToken = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: "asia-northeast3",
}, async (request) => {
// 인증 확인
Expand Down Expand Up @@ -267,7 +267,7 @@ export const refreshAppleAccessToken = onCall({

export const revokeAppleAccessToken = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: "asia-northeast3",
}, async (request) => {
// 인증 확인
Expand Down
4 changes: 2 additions & 2 deletions Firebase/functions/src/auth/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import axios from "axios";
// GitHub OAuth 인증 및 커스텀 토큰 발급 함수
export const requestGithubTokens = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: "asia-northeast3",
}, async (request) => {
try {
Expand Down Expand Up @@ -103,7 +103,7 @@ export const requestGithubTokens = onCall({

export const revokeGithubAccessToken = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: "asia-northeast3",
}, async (request) => {
try {
Expand Down
1 change: 1 addition & 0 deletions Firebase/functions/src/fcm/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type FirestoreErrorLike = {

// Cloud Tasks에 의해 트리거되는 함수
export const sendPushNotification = onTaskDispatched({
maxInstances: 2,
region: "asia-northeast3",
retryConfig: { maxAttempts: 3, minBackoffSeconds: 5 },
rateLimits: { maxDispatchesPerSecond: 200 },
Expand Down
1 change: 1 addition & 0 deletions Firebase/functions/src/fcm/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ErrorLike = {
};

export const scheduleTodoReminder = onSchedule({
maxInstances: 1,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

onSchedule 함수의 maxInstances를 1로 설정할 경우, 이전 실행이 5분 내에 끝나지 않으면 다음 스케줄 실행이 실패할 수 있습니다. 현재 모든 사용자를 조회하는 로직의 특성상 사용자 증가 시 실행 시간이 길어질 수 있으므로, 실행 시간을 모니터링하거나 인스턴스 제한을 소폭 늘리는 것을 검토해 주세요.

region: LOCATION,
schedule: "*/5 * * * *",
timeZone: "UTC"
Expand Down
5 changes: 3 additions & 2 deletions Firebase/functions/src/notification/deletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type NotificationDeletionTaskData = {

export const requestPushNotificationDeletion = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: LOCATION,
},
async (request) => {
Expand Down Expand Up @@ -94,7 +94,7 @@ export const requestPushNotificationDeletion = onCall({

export const undoPushNotificationDeletion = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: LOCATION,
},
async (request) => {
Expand Down Expand Up @@ -147,6 +147,7 @@ export const undoPushNotificationDeletion = onCall({
);

export const completePushNotificationDeletion = onTaskDispatched({
maxInstances: 1,
region: LOCATION,
retryConfig: {maxAttempts: 3, minBackoffSeconds: 5},
rateLimits: {maxDispatchesPerSecond: 200},
Expand Down
3 changes: 3 additions & 0 deletions Firebase/functions/src/todo/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const DELETE_BATCH_SIZE = 200;
const QUERY_BATCH_SIZE = 100;

export const removeTodoNotificationDocuments = onDocumentDeleted({
maxInstances: 1,
document: "users/{userId}/todoLists/{todoId}",
region: LOCATION
},
Expand All @@ -29,6 +30,7 @@ export const removeTodoNotificationDocuments = onDocumentDeleted({
);

export const removeCompletedTodoNotificationRecords = onDocumentUpdated({
maxInstances: 1,
document: "users/{userId}/todoLists/{todoId}",
region: LOCATION
},
Expand Down Expand Up @@ -64,6 +66,7 @@ export const removeCompletedTodoNotificationRecords = onDocumentUpdated({
);

export const cleanupUnusedTodoNotificationRecords = onSchedule({
maxInstances: 1,
region: LOCATION,
schedule: "0 * * * *",
timeZone: "UTC"
Expand Down
5 changes: 3 additions & 2 deletions Firebase/functions/src/todo/deletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type TodoDeletionTaskData = {

export const requestTodoDeletion = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: LOCATION,
},
async (request) => {
Expand Down Expand Up @@ -105,7 +105,7 @@ export const requestTodoDeletion = onCall({

export const undoTodoDeletion = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: LOCATION,
},
async (request) => {
Expand Down Expand Up @@ -163,6 +163,7 @@ export const undoTodoDeletion = onCall({
);

export const completeTodoDeletion = onTaskDispatched({
maxInstances: 1,
region: LOCATION,
retryConfig: {maxAttempts: 3, minBackoffSeconds: 5},
rateLimits: {maxDispatchesPerSecond: 200},
Expand Down
1 change: 1 addition & 0 deletions Firebase/functions/src/todo/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const LOCATION = "asia-northeast3";
const BATCH_SIZE = 200;

export const syncTodoNotificationCategory = onDocumentUpdated({
maxInstances: 1,
document: "users/{userId}/todoLists/{todoId}",
region: LOCATION
},
Expand Down
2 changes: 2 additions & 0 deletions Firebase/functions/src/todoCategory/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type TodoCategoryUpdateTaskData = {
};

export const requestMoveRemovedCategoryTodosToEtc = onDocumentUpdated({
maxInstances: 1,
document: "users/{userId}/userData/categories",
region: LOCATION
},
Expand Down Expand Up @@ -80,6 +81,7 @@ export const requestMoveRemovedCategoryTodosToEtc = onDocumentUpdated({
);

export const completeMoveRemovedCategoryTodosToEtc = onTaskDispatched({
maxInstances: 1,
region: LOCATION,
retryConfig: { maxAttempts: 3, minBackoffSeconds: 5 },
rateLimits: { maxDispatchesPerSecond: 20 },
Expand Down
3 changes: 3 additions & 0 deletions Firebase/functions/src/user/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import * as admin from "firebase-admin";
import * as logger from "firebase-functions/logger";

export const cleanupDeletedUserFirestoreData = functions
.runWith({
maxInstances: 1
})
.region("asia-northeast3")
.auth
.user()
Expand Down
5 changes: 3 additions & 2 deletions Firebase/functions/src/webPage/deletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type WebPageDeletionTaskData = {

export const requestWebPageDeletion = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: LOCATION,
},
async (request) => {
Expand Down Expand Up @@ -101,7 +101,7 @@ export const requestWebPageDeletion = onCall({

export const undoWebPageDeletion = onCall({
cors: true,
maxInstances: 10,
maxInstances: 3,
region: LOCATION,
},
async (request) => {
Expand Down Expand Up @@ -163,6 +163,7 @@ export const undoWebPageDeletion = onCall({
);

export const completeWebPageDeletion = onTaskDispatched({
maxInstances: 1,
region: LOCATION,
retryConfig: { maxAttempts: 3, minBackoffSeconds: 5 },
rateLimits: { maxDispatchesPerSecond: 200 },
Expand Down