Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Avoid redundant look up for sub and users

Neeraj Gupta32feb78615f6
diff --git a/server/pkg/controller/user/inactive_user_orchestrator.go b/server/pkg/controller/user/inactive_user_orchestrator.go
index 7e0d773f76..5f31ed147a 100644
--- a/server/pkg/controller/user/inactive_user_orchestrator.go
+++ b/server/pkg/controller/user/inactive_user_orchestrator.go
@@ -159,6 +159,14 @@ func (c *InactiveUserOrchestrator) ProcessInactiveUsers() {
}
func (c *InactiveUserOrchestrator) processCandidate(candidate repo.UserInactivityCandidate, now int64) (bool, error) {
+ stageHint, err := c.resolveNextStage(candidate.UserID, candidate.LastActivity, now)
+ if err != nil {
+ return false, err
+ }
+ if stageHint == inactivityEmailStageNone {
+ return false, nil
+ }
+
user, err := c.UserRepo.Get(candidate.UserID)
if err != nil {
if errors.Is(err, ente.ErrUserDeleted) {
@@ -189,9 +197,12 @@ func (c *InactiveUserOrchestrator) processCandidate(candidate repo.UserInactivit
return false, nil
}
- stage, err := c.resolveNextStage(user.ID, lastActivity, now)
- if err != nil {
- return false, err
+ stage := stageHint
+ if lastActivity != candidate.LastActivity {
+ stage, err = c.resolveNextStage(user.ID, lastActivity, now)
+ if err != nil {
+ return false, err
+ }
}
if stage == inactivityEmailStageNone {
return false, nil