Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 apps/coordinator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"license": "MIT",
"dependencies": {
"@trigger.dev/core": "workspace:*",
"execa": "^8.0.1",
"nanoid": "^5.0.6",
"prom-client": "^15.1.0",
"socket.io": "4.7.4"
"socket.io": "4.7.4",
"tinyexec": "^0.3.0"
},
"devDependencies": {
"@types/node": "^18",
Expand Down
15 changes: 2 additions & 13 deletions 15 apps/coordinator/src/chaosMonkey.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { Execa$ } from "execa";
import { setTimeout as timeout } from "node:timers/promises";

class ChaosMonkeyError extends Error {
Expand Down Expand Up @@ -35,11 +34,9 @@ export class ChaosMonkey {
}

async call({
$,
throwErrors = !this.disableErrors,
addDelays = !this.disableDelays,
}: {
$?: Execa$<string>;
throwErrors?: boolean;
addDelays?: boolean;
} = {}) {
Expand All @@ -60,23 +57,15 @@ export class ChaosMonkey {
chaosEvents.push(async () => {
console.log("🍌 Chaos monkey: Add delay");

if ($) {
await $`sleep ${this.delayInSeconds}`;
} else {
await timeout(this.delayInSeconds * 1000);
}
await timeout(this.delayInSeconds * 1000);
});
}

if (throwErrors) {
chaosEvents.push(async () => {
console.log("🍌 Chaos monkey: Throw error");

if ($) {
await $`false`;
} else {
throw new ChaosMonkey.Error("🍌 Chaos monkey: Throw error");
}
throw new ChaosMonkey.Error("🍌 Chaos monkey: Throw error");
});
}

Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.