Files
peertube-server/scripts/simulate-many-viewers-worker.js
Chocobozzz 46cbbd487c Best effort for keeping order in AP
Lock objects when receiving activities, and use a global concurrency of
1 when sending them
2026-10-05 13:43:08 +02:00

10 lines
499 B
JavaScript

import { promiseMap } from "@peertube/peertube-core-utils";
import { PeerTubeServer } from "@peertube/peertube-server-commands";
module.exports = async function sendViews(options) {
const { url, videoId, viewers } = options;
const server = new PeerTubeServer({ url });
await promiseMap(viewers, (viewer) => {
return server.views.simulateView({ id: videoId, xForwardedFor: viewer.xForwardedFor }).catch((err) => console.error("Cannot simulate viewer", err));
}, { concurrency: 500 });
};