sparcs-kaist / taxi-infra

KAIST Taxi Party Matching Web Service
https://taxi.kaist.ac.kr
MIT License
7 stars 0 forks source link

FCM token-topic pair 주기적으로 삭제 #22

Open withSang opened 1 year ago

withSang commented 1 year ago

FC https://firebase.google.com/docs/cloud-messaging/manage-tokens#unsubscribe_stale_tokens_from_topics

Summary

토큰이 주기적으로 만료되기 때문에, FCM에서는 1-2달에 한 번씩 토픽에 구독된 토큰들을 삭제하는 것을 권장하고 있습니다. 택시 데이터베이스의 topicsubscriptions 컬렉션에 각 토큰이 구독된 토픽과 구독 시각이 저장되기 때문에, 이 정보를 사용하여 주기적으로 구독한 지 1-2달이 된 토큰들을 구독 해제하는 기능이 taxi-scheduler에 필요합니다. 이 과정에서 Firebase Admin SDK가 필요하면, node-cron 같은 걸 써서 taxi-scheduler를 쉘 스크립트 대신 node 스크립트로 개편하는 것도 좋겠다고 생각합니다.

Tasks

withSang commented 1 year ago

만료된 토큰을 제거하는 기능이 taxi-back에 부분적으로 추가됐기 때문에, taxi-back에 만료된 토큰에 대한 토큰-토픽 쌍을 삭제하는 기능도 추가하면 이 이슈는 해결할 필요가 없어질 거라고 생각해요.