@@ -31,9 +31,8 @@ func (s *APIStore) GetSandboxesSandboxIDRecord(c *gin.Context, sandboxID api.San
3131 telemetry .SetAttributes (ctx , telemetry .WithTeamID (teamID .String ()), telemetry .WithSandboxID (sandboxID ))
3232
3333 row , err := s .db .GetSandboxRecordByTeamAndSandboxID (ctx , queries.GetSandboxRecordByTeamAndSandboxIDParams {
34- TeamID : teamID ,
35- SandboxID : sandboxID ,
36- CreatedAfter : time .Now ().UTC ().Add (- sandboxRecordRetention ),
34+ TeamID : teamID ,
35+ SandboxID : sandboxID ,
3736 })
3837 if err != nil {
3938 if dberrors .IsNotFoundError (err ) || isUndefinedTableError (err ) {
@@ -53,16 +52,21 @@ func (s *APIStore) GetSandboxesSandboxIDRecord(c *gin.Context, sandboxID api.San
5352 alias = & row .Alias
5453 }
5554
55+ // The sandbox's monitoring, events, and logs data is purged once the
56+ // sandbox ended more than the retention window ago.
57+ retentionExpired := row .StoppedAt != nil && time .Since (* row .StoppedAt ) > sandboxRecordRetention
58+
5659 c .JSON (http .StatusOK , api.SandboxRecord {
57- TemplateID : row .TemplateID ,
58- Alias : alias ,
59- SandboxID : row .SandboxID ,
60- StartedAt : row .StartedAt ,
61- StoppedAt : row .StoppedAt ,
62- Domain : row .Domain ,
63- CpuCount : row .Vcpu ,
64- MemoryMB : row .RamMb ,
65- DiskSizeMB : row .TotalDiskSizeMb ,
60+ TemplateID : row .TemplateID ,
61+ Alias : alias ,
62+ SandboxID : row .SandboxID ,
63+ StartedAt : row .StartedAt ,
64+ StoppedAt : row .StoppedAt ,
65+ Domain : row .Domain ,
66+ CpuCount : row .Vcpu ,
67+ MemoryMB : row .RamMb ,
68+ DiskSizeMB : row .TotalDiskSizeMb ,
69+ RetentionExpired : retentionExpired ,
6670 })
6771}
6872
0 commit comments