1
0
Fork 0
peertube/scripts/simulate-many-viewers-worker.js

10 lines
474 B
JavaScript
Raw Normal View History

2024-02-29 04:09:03 -05:00
import Bluebird from "bluebird";
import { PeerTubeServer } from "@peertube/peertube-server-commands";
module.exports = async function sendViews(options) {
const { url, videoId, viewers } = options;
const server = new PeerTubeServer({ url });
await Bluebird.map(viewers, (viewer) => {
return server.views.simulateView({ id: videoId, xForwardedFor: viewer.xForwardedFor }).catch((err) => console.error("Cannot simulate viewer", err));
}, { concurrency: 500 });
};