feat(worker): add device registration_id cleanup worker
Add DeviceCleanupWorker to periodically clean up stale device tokens that haven't been used within the retention period. This prevents accumulation of invalid registration_ids and maintains data hygiene. - New DeviceCleanupConfig with enabled, retention_days (3), and interval_minutes (360) - New repository methods DeleteStaleDevices and DeleteOldestActiveDevice - Updated RegisterDevice to evict oldest active device when reaching limit - Reduced MaxDevicesPerUser from 10 to 3 per user - Worker integrated into app startup/shutdown lifecycle
This commit is contained in:
@@ -159,6 +159,14 @@ upload:
|
||||
- image/gif
|
||||
- image/webp
|
||||
|
||||
# 设备 registration_id 清理配置
|
||||
# 周期性清理超过保留期未使用的设备 token,避免无效 registration_id 累积
|
||||
# 环境变量: APP_DEVICE_CLEANUP_ENABLED, APP_DEVICE_CLEANUP_RETENTION_DAYS, APP_DEVICE_CLEANUP_INTERVAL_MINUTES
|
||||
device_cleanup:
|
||||
enabled: true # 是否启用清理 worker
|
||||
retention_days: 3 # 保留天数,3 天不活跃即清理(按 last_used_at 判断)
|
||||
interval_minutes: 360 # 扫描间隔(分钟),默认 6 小时
|
||||
|
||||
# 敏感词过滤配置
|
||||
sensitive:
|
||||
enabled: true
|
||||
|
||||
Reference in New Issue
Block a user