-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
28163e5
commit 1f9f8f8
Showing
18 changed files
with
132 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,5 @@ await main({ | |
verbose, | ||
reportFile: report, | ||
remoteUrl, | ||
include: [], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { AbstractReporter } from "./abstract.ts"; | ||
import type { ReporterChangeData, Workflow } from "../types.ts"; | ||
import { assert } from "../deps.ts"; | ||
|
||
export interface PingReporterOptions { | ||
url: string; | ||
interval?: number; | ||
} | ||
|
||
export class PingReporter extends AbstractReporter<PingReporterOptions> { | ||
#lock = false; | ||
#pingInterval: number | null = null; | ||
|
||
override setOptions(options: PingReporterOptions) { | ||
super.setOptions(options); | ||
|
||
assert(options.url, "Ping URL is required for PingReporter"); | ||
|
||
this._startPingInterval(); | ||
} | ||
|
||
override async destroy() { | ||
await Promise.resolve(() => this._stopPingInterval()); | ||
} | ||
|
||
_startPingInterval() { | ||
this._stopPingInterval(); | ||
this.#pingInterval = setInterval(() => { | ||
this._ping(); | ||
}, 1000 * (this.options.interval ?? 60)); | ||
} | ||
|
||
_stopPingInterval() { | ||
this.#pingInterval && clearInterval(this.#pingInterval); | ||
} | ||
|
||
async execute() { | ||
} | ||
|
||
async report( | ||
_report: Workflow.Report, | ||
_configuration?: Workflow.Configuration, | ||
): Promise<void> { | ||
} | ||
|
||
async change(_type: string, _data: ReporterChangeData): Promise<void> { | ||
} | ||
|
||
async _ping(): Promise<void> { | ||
if (this.#lock) { | ||
return; | ||
} | ||
|
||
try { | ||
await fetch(this.options.url, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify(new Date().getTime().toString()), | ||
}); | ||
} catch (error) { | ||
console.error("Error pinging", error); | ||
} finally { | ||
this.#lock = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// deno-lint-ignore-file | ||
|
||
import { z } from "../deps.ts"; | ||
import { WorkflowSchema } from "./workflow.ts"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// deno-lint-ignore-file | ||
|
||
import { z } from "../deps.ts"; | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// deno-lint-ignore-file | ||
|
||
import { z } from "../deps.ts"; | ||
|
||
import { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// deno-lint-ignore-file | ||
|
||
import { z } from "../deps.ts"; | ||
import { JobSchema } from "./job.ts"; | ||
import { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters