Skip to content

Commit a0fd16a

Browse files
committed
Support BGSAVE SCHEDULE
This is needed to support redis-py 4.0.
1 parent ef52a50 commit a0fd16a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

fakeredis/_server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,8 +2355,10 @@ def zinterstore(self, dest, numkeys, *args):
23552355
# Server commands
23562356
# TODO: lots
23572357

2358-
@command((), flags='s')
2359-
def bgsave(self):
2358+
@command((), (bytes,), flags='s')
2359+
def bgsave(self, *args):
2360+
if len(args) > 1 or (len(args) == 1 and not casematch(args[0], b'schedule')):
2361+
raise SimpleError(SYNTAX_ERROR_MSG)
23602362
self._server.lastsave = int(time.time())
23612363
return BGSAVE_STARTED
23622364

test/test_fakeredis.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,6 +3454,10 @@ def test_save(r):
34543454

34553455
def test_bgsave(r):
34563456
assert r.bgsave()
3457+
with pytest.raises(ResponseError):
3458+
r.execute_command('BGSAVE', 'SCHEDULE', 'FOO')
3459+
with pytest.raises(ResponseError):
3460+
r.execute_command('BGSAVE', 'FOO')
34573461

34583462

34593463
def test_lastsave(r):

0 commit comments

Comments
 (0)