BYOK Personal Data Server (PDS) written in Go
ipfs vow atproto pds go
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: autodelete expired tokens

+15
+15
server/server.go
··· 659 659 } 660 660 }() 661 661 662 + go s.cleanupExpiredSessions(ctx) 663 + 662 664 <-ctx.Done() 663 665 664 666 s.logger.Info("shut down") ··· 693 695 s.lastRequestCrawl = time.Now() 694 696 695 697 return nil 698 + } 699 + 700 + func (s *Server) cleanupExpiredSessions(ctx context.Context) { 701 + logger := s.logger.With("component", "session-cleanup") 702 + ticker := time.NewTicker(24 * time.Hour) 703 + defer ticker.Stop() 704 + 705 + for range ticker.C { 706 + cutoff := time.Now().Add(-constants.ConfidentialClientRefreshLifetime) 707 + if err := s.db.Exec(ctx, "DELETE FROM oauth_tokens WHERE updated_at < ?", nil, cutoff).Error; err != nil { 708 + logger.Error("failed to cleanup expired oauth sessions", "error", err) 709 + } 710 + } 696 711 } 697 712 698 713 func (s *Server) UpdateRepo(ctx context.Context, did string, root cid.Cid, rev string) error {