@andreabiagini5/applicazioni-e-servizi-web-project
Version:
Project for Applicazioni e Servizi Web.
24 lines • 749 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setRoutine = exports.startRoutines = void 0;
const matchmaking_1 = require("./matchmaking");
const MATCHMAKING_ROUTINE_INTERVAL = 5000;
/**
* Starts the server routines.
*/
const startRoutines = () => {
(0, exports.setRoutine)(matchmaking_1.createMatchIfPossible, MATCHMAKING_ROUTINE_INTERVAL);
};
exports.startRoutines = startRoutines;
/**
* Sets a routine to run at a specified interval.
* @param task The task to run.
* @param interval The interval in milliseconds.
*/
const setRoutine = (task, interval) => {
setInterval(async () => {
await task();
}, interval);
};
exports.setRoutine = setRoutine;
//# sourceMappingURL=routine.js.map