forked from parse-community/parse-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Upgrade Redis 3 to 4 for LiveQuery (parse-community#8333)
- Loading branch information
Showing
10 changed files
with
136 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
if (process.env.PARSE_SERVER_TEST_CACHE === 'redis') { | ||
describe('ParseLiveQuery redis', () => { | ||
afterEach(async () => { | ||
const client = await Parse.CoreManager.getLiveQueryController().getDefaultLiveQueryClient(); | ||
client.close(); | ||
}); | ||
it('can connect', async () => { | ||
await reconfigureServer({ | ||
startLiveQueryServer: true, | ||
liveQuery: { | ||
classNames: ['TestObject'], | ||
redisURL: 'redis://localhost:6379', | ||
}, | ||
liveQueryServerOptions: { | ||
redisURL: 'redis://localhost:6379', | ||
}, | ||
}); | ||
const subscription = await new Parse.Query('TestObject').subscribe(); | ||
const [object] = await Promise.all([ | ||
new Parse.Object('TestObject').save(), | ||
new Promise(resolve => | ||
subscription.on('create', () => { | ||
resolve(); | ||
}) | ||
), | ||
]); | ||
await Promise.all([ | ||
new Promise(resolve => | ||
subscription.on('delete', () => { | ||
resolve(); | ||
}) | ||
), | ||
object.destroy(), | ||
]); | ||
}); | ||
|
||
it('can call connect twice', async () => { | ||
const server = await reconfigureServer({ | ||
startLiveQueryServer: true, | ||
liveQuery: { | ||
classNames: ['TestObject'], | ||
redisURL: 'redis://localhost:6379', | ||
}, | ||
liveQueryServerOptions: { | ||
redisURL: 'redis://localhost:6379', | ||
}, | ||
}); | ||
expect(server.config.liveQueryController.liveQueryPublisher.parsePublisher.isOpen).toBeTrue(); | ||
await server.config.liveQueryController.connect(); | ||
expect(server.config.liveQueryController.liveQueryPublisher.parsePublisher.isOpen).toBeTrue(); | ||
expect(server.liveQueryServer.subscriber.isOpen).toBe(true); | ||
await server.liveQueryServer.connect(); | ||
expect(server.liveQueryServer.subscriber.isOpen).toBe(true); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters