@@ -87,6 +87,8 @@ async def cull_idle(
87
87
internal_certs_location = "" ,
88
88
cull_admin_users = True ,
89
89
api_page_size = 0 ,
90
+ cull_default_servers = True ,
91
+ cull_named_servers = True ,
90
92
):
91
93
"""Shutdown idle single-user servers
92
94
@@ -235,7 +237,7 @@ async def handle_server(user, server_name, server, max_age, inactive_limit):
235
237
# inactive_limit = server['state']['culltime']
236
238
237
239
should_cull = (
238
- inactive is not None and inactive .total_seconds () >= inactive_limit
240
+ inactive is not None and inactive .total_seconds () >= inactive_limit and (( cull_default_servers and server_name == "" ) or ( cull_named_servers and server_name ))
239
241
)
240
242
if should_cull :
241
243
app_log .info (
@@ -561,6 +563,26 @@ def main():
561
563
"""
562
564
).strip (),
563
565
)
566
+ define (
567
+ "cull_default_servers" ,
568
+ type = bool ,
569
+ default = True ,
570
+ help = dedent (
571
+ """
572
+ Whether default servers should be culled (only if --cull-default-servers=true).
573
+ """
574
+ ).strip (),
575
+ )
576
+ define (
577
+ "cull_named_servers" ,
578
+ type = bool ,
579
+ default = True ,
580
+ help = dedent (
581
+ """
582
+ Whether named servers should be culled (only if --cull-named-servers=true).
583
+ """
584
+ ).strip (),
585
+ )
564
586
565
587
parse_command_line ()
566
588
if not options .cull_every :
@@ -589,6 +611,8 @@ def main():
589
611
internal_certs_location = options .internal_certs_location ,
590
612
cull_admin_users = options .cull_admin_users ,
591
613
api_page_size = options .api_page_size ,
614
+ cull_default_servers = options .cull_default_servers ,
615
+ cull_named_servers = options .cull_named_servers ,
592
616
)
593
617
# schedule first cull immediately
594
618
# because PeriodicCallback doesn't start until the end of the first interval
0 commit comments