feat: enhance schedule publish account handling and caching mechanisms
Frontend CI / Frontend (push) Successful in 3m1s
Backend CI / Backend (push) Failing after 6m51s

This commit is contained in:
2026-06-21 09:11:37 +08:00
parent c1b06dab18
commit 37d75597f9
6 changed files with 125 additions and 54 deletions
@@ -16,6 +16,7 @@ import (
goredis "github.com/redis/go-redis/v9"
"github.com/geo-platform/tenant-api/internal/shared/auth"
sharedcache "github.com/geo-platform/tenant-api/internal/shared/cache"
"github.com/geo-platform/tenant-api/internal/shared/messaging/rabbitmq"
"github.com/geo-platform/tenant-api/internal/shared/response"
"github.com/geo-platform/tenant-api/internal/tenant/repository"
@@ -27,6 +28,7 @@ type DesktopAccountService struct {
pool *pgxpool.Pool
repo repository.DesktopAccountRepository
clientRepo repository.DesktopClientRepository
cache sharedcache.Cache
redis *goredis.Client
rabbitMQ *rabbitmq.Client
now func() time.Time
@@ -49,6 +51,11 @@ func NewDesktopAccountService(
}
}
func (s *DesktopAccountService) WithCache(c sharedcache.Cache) *DesktopAccountService {
s.cache = c
return s
}
type DesktopAccountView struct {
ID string `json:"id"`
Platform string `json:"platform"`
@@ -389,6 +396,7 @@ func (s *DesktopAccountService) Tombstone(ctx context.Context, client *repositor
}
view := s.buildDesktopAccountView(account, nil, nil, nil, nil)
invalidateScheduleTaskCaches(ctx, s.cache, client.TenantID, nil)
return &view, nil
}
@@ -451,6 +459,7 @@ func (s *DesktopAccountService) DeleteForActor(ctx context.Context, actor auth.A
}
view := s.buildDesktopAccountView(account, nil, nil, nil, nil)
invalidateScheduleTaskCaches(ctx, s.cache, actor.TenantID, nil)
return &DesktopAccountDeleteResult{
Account: view,
CancelledQueuedPublishTasks: cancelled,