mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
feat: add scheduler (#30)
This commit is contained in:
@@ -4,17 +4,20 @@ import { Runner } from '../runner/runner.js';
|
||||
import { Config } from '../config/config.js';
|
||||
import { Auth } from '../auth/auth.js';
|
||||
import { resolve } from 'path';
|
||||
import { Scheduler } from '../scheduler/scheduler.js';
|
||||
|
||||
class Runtime {
|
||||
#repos: Repos;
|
||||
#runner: Runner;
|
||||
#auth: Auth;
|
||||
#scheduler: Scheduler;
|
||||
|
||||
constructor(options: Config) {
|
||||
const database = new Database(options.database);
|
||||
this.#repos = new Repos({ database, config: options });
|
||||
this.#runner = new Runner({ repos: this.#repos, config: options });
|
||||
this.#auth = new Auth({ config: options });
|
||||
this.#scheduler = new Scheduler({ runs: this.#repos.runs, schedules: this.#repos.schedules });
|
||||
}
|
||||
|
||||
public get repos() {
|
||||
@@ -29,6 +32,10 @@ class Runtime {
|
||||
return this.#auth;
|
||||
}
|
||||
|
||||
public get scheduler() {
|
||||
return this.#scheduler;
|
||||
}
|
||||
|
||||
public static create = async () => {
|
||||
const runtime = new Runtime({
|
||||
database: {
|
||||
|
||||
Reference in New Issue
Block a user