File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -268,12 +268,15 @@ def bgrewriteaof(self):
268
268
"Tell the Redis server to rewrite the AOF file from data in memory."
269
269
return self .execute_command ('BGREWRITEAOF' )
270
270
271
- def bgsave (self ):
271
+ def bgsave (self , schedule = True ):
272
272
"""
273
273
Tell the Redis server to save its data to disk. Unlike save(),
274
274
this method is asynchronous and returns immediately.
275
275
"""
276
- return self .execute_command ('BGSAVE' )
276
+ pieces = []
277
+ if schedule :
278
+ pieces .append ("SCHEDULE" )
279
+ return self .execute_command ('BGSAVE' , * pieces )
277
280
278
281
def client_kill (self , address ):
279
282
"Disconnects the client at ``address`` (ip:port)"
Original file line number Diff line number Diff line change @@ -547,6 +547,11 @@ def test_time(self, r):
547
547
assert isinstance (t [0 ], int )
548
548
assert isinstance (t [1 ], int )
549
549
550
+ def test_bgsave (self , r ):
551
+ assert r .bgsave ()
552
+ time .sleep (0.3 )
553
+ assert r .bgsave (True )
554
+
550
555
# BASIC KEY COMMANDS
551
556
def test_append (self , r ):
552
557
assert r .append ('a' , 'a1' ) == 2
You can’t perform that action at this time.
0 commit comments