@@ -149,37 +149,34 @@ func (r *Reporter) ReportAgentStats(ctx context.Context, now time.Time, workspac
149
149
return nil
150
150
}
151
151
152
- // Prebuilds are not subject to activity-based deadline bumps
153
- if ! workspace .IsPrebuild () {
154
- // check next autostart
155
- var nextAutostart time.Time
156
- if workspace .AutostartSchedule .String != "" {
157
- templateSchedule , err := (* (r .opts .TemplateScheduleStore .Load ())).Get (ctx , r .opts .Database , workspace .TemplateID )
158
- // If the template schedule fails to load, just default to bumping
159
- // without the next transition and log it.
160
- switch {
161
- case err == nil :
162
- next , allowed := schedule .NextAutostart (now , workspace .AutostartSchedule .String , templateSchedule )
163
- if allowed {
164
- nextAutostart = next
165
- }
166
- case database .IsQueryCanceledError (err ):
167
- r .opts .Logger .Debug (ctx , "query canceled while loading template schedule" ,
168
- slog .F ("workspace_id" , workspace .ID ),
169
- slog .F ("template_id" , workspace .TemplateID ))
170
- default :
171
- r .opts .Logger .Error (ctx , "failed to load template schedule bumping activity, defaulting to bumping by 60min" ,
172
- slog .F ("workspace_id" , workspace .ID ),
173
- slog .F ("template_id" , workspace .TemplateID ),
174
- slog .Error (err ),
175
- )
152
+ // check next autostart
153
+ var nextAutostart time.Time
154
+ if workspace .AutostartSchedule .String != "" {
155
+ templateSchedule , err := (* (r .opts .TemplateScheduleStore .Load ())).Get (ctx , r .opts .Database , workspace .TemplateID )
156
+ // If the template schedule fails to load, just default to bumping
157
+ // without the next transition and log it.
158
+ switch {
159
+ case err == nil :
160
+ next , allowed := schedule .NextAutostart (now , workspace .AutostartSchedule .String , templateSchedule )
161
+ if allowed {
162
+ nextAutostart = next
176
163
}
164
+ case database .IsQueryCanceledError (err ):
165
+ r .opts .Logger .Debug (ctx , "query canceled while loading template schedule" ,
166
+ slog .F ("workspace_id" , workspace .ID ),
167
+ slog .F ("template_id" , workspace .TemplateID ))
168
+ default :
169
+ r .opts .Logger .Error (ctx , "failed to load template schedule bumping activity, defaulting to bumping by 60min" ,
170
+ slog .F ("workspace_id" , workspace .ID ),
171
+ slog .F ("template_id" , workspace .TemplateID ),
172
+ slog .Error (err ),
173
+ )
177
174
}
178
-
179
- // bump workspace activity
180
- ActivityBumpWorkspace (ctx , r .opts .Logger .Named ("activity_bump" ), r .opts .Database , workspace .ID , nextAutostart )
181
175
}
182
176
177
+ // bump workspace activity
178
+ ActivityBumpWorkspace (ctx , r .opts .Logger .Named ("activity_bump" ), r .opts .Database , workspace .ID , nextAutostart )
179
+
183
180
// bump workspace last_used_at
184
181
r .opts .UsageTracker .Add (workspace .ID )
185
182
0 commit comments