@@ -1153,12 +1153,25 @@ def save(self, **kwargs) -> ResponseT:
1153
1153
"""
1154
1154
return self .execute_command ("SAVE" , ** kwargs )
1155
1155
1156
- def shutdown (self , save : bool = False , nosave : bool = False , ** kwargs ) -> None :
1156
+ def shutdown (
1157
+ self ,
1158
+ save : bool = False ,
1159
+ nosave : bool = False ,
1160
+ now : bool = False ,
1161
+ force : bool = False ,
1162
+ abort : bool = False ,
1163
+ ** kwargs ,
1164
+ ) -> None :
1157
1165
"""Shutdown the Redis server. If Redis has persistence configured,
1158
- data will be flushed before shutdown. If the "save" option is set,
1159
- a data flush will be attempted even if there is no persistence
1160
- configured. If the "nosave" option is set, no data flush will be
1161
- attempted. The "save" and "nosave" options cannot both be set.
1166
+ data will be flushed before shutdown.
1167
+ It is possible to specify modifiers to alter the behavior of the command:
1168
+ ``save`` will force a DB saving operation even if no save points are configured.
1169
+ ``nosave`` will prevent a DB saving operation even if one or more save points
1170
+ are configured.
1171
+ ``now`` skips waiting for lagging replicas, i.e. it bypasses the first step in
1172
+ the shutdown sequence.
1173
+ ``force`` ignores any errors that would normally prevent the server from exiting
1174
+ ``abort`` cancels an ongoing shutdown and cannot be combined with other flags.
1162
1175
1163
1176
For more information see https://redis.io/commands/shutdown
1164
1177
"""
@@ -1169,6 +1182,12 @@ def shutdown(self, save: bool = False, nosave: bool = False, **kwargs) -> None:
1169
1182
args .append ("SAVE" )
1170
1183
if nosave :
1171
1184
args .append ("NOSAVE" )
1185
+ if now :
1186
+ args .append ("NOW" )
1187
+ if force :
1188
+ args .append ("FORCE" )
1189
+ if abort :
1190
+ args .append ("ABORT" )
1172
1191
try :
1173
1192
self .execute_command (* args , ** kwargs )
1174
1193
except ConnectionError :
@@ -1279,7 +1298,13 @@ async def memory_help(self, **kwargs) -> None:
1279
1298
return super ().memory_help (** kwargs )
1280
1299
1281
1300
async def shutdown (
1282
- self , save : bool = False , nosave : bool = False , ** kwargs
1301
+ self ,
1302
+ save : bool = False ,
1303
+ nosave : bool = False ,
1304
+ now : bool = False ,
1305
+ force : bool = False ,
1306
+ abort : bool = False ,
1307
+ ** kwargs ,
1283
1308
) -> None :
1284
1309
"""Shutdown the Redis server. If Redis has persistence configured,
1285
1310
data will be flushed before shutdown. If the "save" option is set,
@@ -1296,6 +1321,12 @@ async def shutdown(
1296
1321
args .append ("SAVE" )
1297
1322
if nosave :
1298
1323
args .append ("NOSAVE" )
1324
+ if now :
1325
+ args .append ("NOW" )
1326
+ if force :
1327
+ args .append ("FORCE" )
1328
+ if abort :
1329
+ args .append ("ABORT" )
1299
1330
try :
1300
1331
await self .execute_command (* args , ** kwargs )
1301
1332
except ConnectionError :
0 commit comments