Connect Cloud continues to serve for 5m46s after final Shiny connection closes

I’m running into usage limits for my R Shiny app on Posit Connect Cloud, and was investigating to see what I could optimize.

Looking at my logs and the downloaded usage CSV, I consistently see 5 minutes and 46 seconds between the last logged client disconnection and the server shutdown. The usage CSV continues to record “serve” time throughout that interval.

For example, from my app’s logs:

2026-11-25T01:39:46.123980Z [runtime] [INFO] [redacted runtime log]
2026-11-25T01:42:05.031311Z [runtime] [INFO] Client connection closed
2026-11-25T01:42:05.031372Z [runtime] [INFO] Shiny connection closed
2026-11-25T01:47:51.099365Z [runtime] [INFO] Stopping server...

And then from the usage CSV:

pod_id,phase,record_type,frame_start,frame_end,frame_duration,wall_seconds,cpu_core_seconds,cpu_limit_cores,mem_working_set_max_bytes,mem_limit_bytes
deployment-019fda9f-ec5c4c61b2cc7222d056585019d04b70-deplodwwmd,serve,periodic,2026-11-25T01:41:37.379368+00:00,2026-11-25T01:42:37.379700+00:00,60.0,60.000331586,0.179614,1.0,519221248,2147483648
deployment-019fda9f-ec5c4c61b2cc7222d056585019d04b70-deplodwwmd,serve,periodic,2026-11-25T01:42:37.379700+00:00,2026-11-25T01:43:37.379369+00:00,59.0,59.999669026,0.158499,1.0,520093696,2147483648
deployment-019fda9f-ec5c4c61b2cc7222d056585019d04b70-deplodwwmd,serve,periodic,2026-11-25T01:43:37.379369+00:00,2026-11-25T01:44:37.379664+00:00,60.0,60.000295356,0.151933,1.0,515948544,2147483648
deployment-019fda9f-ec5c4c61b2cc7222d056585019d04b70-deplodwwmd,serve,periodic,2026-11-25T01:44:37.379664+00:00,2026-11-25T01:45:37.379247+00:00,59.0,59.999582552,0.144954,1.0,512692224,2147483648
deployment-019fda9f-ec5c4c61b2cc7222d056585019d04b70-deplodwwmd,serve,periodic,2026-11-25T01:45:37.379247+00:00,2026-11-25T01:46:37.379481+00:00,60.0,60.000233879,0.146545,1.0,513261568,2147483648
deployment-019fda9f-ec5c4c61b2cc7222d056585019d04b70-deplodwwmd,serve,periodic,2026-11-25T01:46:37.379481+00:00,2026-11-25T01:47:37.379463+00:00,59.0,59.999982616,0.158613,1.0,513527808,2147483648
deployment-019fda9f-ec5c4c61b2cc7222d056585019d04b70-deplodwwmd,serve,lifecycle,2026-11-25T01:47:37.379463+00:00,2026-11-25T01:47:51.102159+00:00,13.0,13.722695366,0.037646,1.0,513306624,2147483648

So the Shiny connection closes at 01:42:05, but the server stops (and usage stops being recorded) at 01:47:51. That 5m46s gap is weirdly consistent across all the instances I see of this in my logs/usage.

My Connection Timeout and Read Timeout are both 2 minutes, and my Worker Idle Timeout is 5 seconds, so I don’t think any of those explain this gap (the 2 minutes does closely match closely the gap between the runtime log and the connection close, which makes sense).

I’d love any advice on whether this is expected or how to resolve it; my app gets a lot of short-lived sessions, so the additional 5m46s billing each time does contribute a fair amount to my usage.

Thanks for the help (and if any additional telemetry or information would be helpful let me know!)

check your compute settings. Per the usage docs, credits per hour = (CPU cores × 0.75) + (memory GB × 0.25). With 1 core and 2 GB, that is 1.25 credits per hour, or about 0.12 credits for each 5m46s tail