Skip to content
Closed
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
2 changes: 1 addition & 1 deletion engine/tests/load/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@rivet/load-tests",
"name": "test-load",
"private": true,
"scripts": {
"build": "tsc",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Smoke Test for RivetKit

Example project demonstrating a simple getOrCreate smoke test with [RivetKit](https://rivetkit.org).

[Learn More →](https://github.com/rivet-dev/rivetkit)

[Discord](https://rivet.dev/discord) — [Documentation](https://rivetkit.org) — [Issues](https://github.com/rivet-dev/rivetkit/issues)

## Getting Started

### Prerequisites
Expand Down Expand Up @@ -34,6 +28,5 @@ npm run smoke

Set `TOTAL_ACTOR_COUNT` and `SPAWN_ACTOR_INTERVAL` environment variables to adjust the workload.

## License
Set `BEHAVIOR` to change the test type.

Apache 2.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "example-smoke-test",
"name": "test-smoke",
"version": "2.0.21",
"private": true,
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ const counter = actor({
state: {
count: 0,
},
onStart: async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
},
onStop: async () => {
await new Promise((resolve) => setTimeout(resolve, 1000));
},
actions: {
increment: (c, x: number) => {
c.state.count += x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function spawnActor(opts: SpawnActorOptions): Promise<void> {
}
}

export async function spawnActorSleepCycle({
export async function spawnActorHttp({
client,
index,
testId,
Expand All @@ -52,15 +52,14 @@ export async function spawnActorSleepCycle({
const iterationDuration = iterationEnd - iterationStart;
iterationDurations.push(iterationDuration);

succeeded = true;
onSuccess();
} catch (error) {
errors.push({ index, error });
onFailure();
}
}

export async function spawnActorHttp({
export async function spawnActorSleepCycle({
client,
index,
testId,
Expand Down Expand Up @@ -89,6 +88,13 @@ export async function spawnActorHttp({
const iterationEnd = performance.now();
const iterationDuration = iterationEnd - iterationStart;
iterationDurations.push(iterationDuration);

// Wait for actor to sleep
// const sleepTime = 1_100 + Math.random() * 800;
const sleepTime = Math.random() * 2500;
console.log("sleeping", sleepTime);
// const sleepTime = 1000;
await new Promise((res) => setTimeout(res, sleepTime));
}

succeeded = true;
Expand Down
File renamed without changes.
File renamed without changes.
Loading
Loading