2020-11-23 19:21:51 +01:00
|
|
|
try {
|
|
|
|
var etherpad = require('../../src/node_modules/etherpad-cli-client');
|
|
|
|
// ugly
|
2020-10-01 11:39:01 +02:00
|
|
|
} catch {
|
2020-11-23 19:21:51 +01:00
|
|
|
var etherpad = require('etherpad-cli-client');
|
2020-10-01 11:39:01 +02:00
|
|
|
}
|
2020-11-23 19:21:51 +01:00
|
|
|
const pad = etherpad.connect(process.argv[2]);
|
|
|
|
pad.on('connected', () => {
|
|
|
|
setTimeout(() => {
|
|
|
|
setInterval(() => {
|
|
|
|
pad.append('1');
|
2020-10-01 11:39:01 +02:00
|
|
|
}, process.argv[3]);
|
2020-11-23 19:21:51 +01:00
|
|
|
}, 500); // wait because CLIENT_READY message is included in ratelimit
|
2020-10-01 11:39:01 +02:00
|
|
|
|
2020-11-23 19:21:51 +01:00
|
|
|
setTimeout(() => {
|
2020-10-01 11:39:01 +02:00
|
|
|
process.exit(0);
|
2020-11-23 19:21:51 +01:00
|
|
|
}, 11000);
|
2020-10-01 11:39:01 +02:00
|
|
|
});
|
|
|
|
// in case of disconnect exit code 1
|
2020-11-23 19:21:51 +01:00
|
|
|
pad.on('message', (message) => {
|
|
|
|
if (message.disconnect == 'rateLimited') {
|
2020-10-01 11:39:01 +02:00
|
|
|
process.exit(1);
|
|
|
|
}
|
2020-11-23 19:21:51 +01:00
|
|
|
});
|