Skip to content

Commit c730fde

Browse files
committed
lint and format
1 parent a65d9b9 commit c730fde

File tree

13 files changed

+18
-39
lines changed

13 files changed

+18
-39
lines changed

activities-stateful/src/activities.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
// in a stateful activity, you would do something like this
77
export class GreetingActivities {
8-
98
private count: number;
109

1110
constructor() {

activities-stateful/src/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { example } from './workflows';
33
import { nanoid } from 'nanoid';
44

55
async function run() {
6-
76
const connection = await Connection.connect({ address: 'localhost:7233' });
87

98
const client = new Client({

activities-stateful/src/worker.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import { NativeConnection, Worker, WorkerOptions } from '@temporalio/worker';
22
// in a stateless activity, you would do something like this
33
//import * as activities from './activities';
44
// in a stateful activity, you would do something like this
5-
import {GreetingActivities} from './activities';
5+
import { GreetingActivities } from './activities';
66

77
async function run() {
8-
98
const connection = await NativeConnection.connect({
109
address: 'localhost:7233',
1110
});
1211
try {
13-
1412
const greeter = new GreetingActivities();
1513

1614
const x: WorkerOptions = {
@@ -27,7 +25,7 @@ async function run() {
2725
// your first attempt may be what's written below, but that won't work because
2826
// you need to bind the method to the instance for `this` to work, as shown above.
2927
// activities: {greet: greeter.greet},
30-
}
28+
};
3129

3230
const worker = await Worker.create(x);
3331

activities-stateful/src/workflows.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ import { proxyActivities, ActivityOptions, RetryPolicy } from '@temporalio/workf
22
// in a stateless activity, you would do something like this
33
// import type * as activities from './activities';
44
// in a stateful activity, you would do something like this
5-
import {GreetingActivities} from './activities';
5+
import { GreetingActivities } from './activities';
66

77
const retryPolicy: RetryPolicy = {
88
backoffCoefficient: 1,
99
initialInterval: 5 * 1000,
10-
}
10+
};
1111

1212
const activityOptions: ActivityOptions = {
1313
retry: retryPolicy,
1414
startToCloseTimeout: 2 * 1000,
15-
}
15+
};
1616

1717
// in a stateless activity, you would do something like this
1818
// const { greet } = proxyActivities<typeof activities>(activityOptions);
1919
// in a stateful activity, you would do something like this
2020
const greeter = new GreetingActivities();
21-
const { greet } = proxyActivities<{greet: typeof greeter.greet}>(activityOptions);
21+
const { greet } = proxyActivities<{ greet: typeof greeter.greet }>(activityOptions);
2222

2323
export async function example(name: string): Promise<string> {
2424
return await greet(name);

polling-frequent/src/activities.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ import { sleep, heartbeat, log } from '@temporalio/activity';
22
import { greetService } from './testService';
33

44
export async function greet(name: string): Promise<string> {
5-
65
// do an infinite loop until the service is ready
7-
while (true) {
6+
for (;;) {
87
try {
9-
let greeting = await greetService(name);
8+
const greeting = await greetService(name);
109
return greeting;
1110
} catch (err) {
1211
log.error(String(err));
1312
}
1413
heartbeat('invoking activity');
1514
await sleep(1 * 1000);
1615
}
17-
1816
}

polling-frequent/src/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { example } from './workflows';
33
import { nanoid } from 'nanoid';
44

55
async function run() {
6-
76
const connection = await Connection.connect({ address: 'localhost:7233' });
87

98
const client = new Client({
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
export async function greetService(name: string): Promise<string> {
42
const randomVal = Math.random();
53

@@ -9,4 +7,3 @@ export async function greetService(name: string): Promise<string> {
97
throw new Error(`Service not ready yet. Random value: ${randomVal.toFixed(2)}`);
108
}
119
}
12-

polling-frequent/src/worker.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@ import { NativeConnection, Worker, WorkerOptions } from '@temporalio/worker';
22
import * as activities from './activities';
33

44
async function run() {
5-
65
const connection = await NativeConnection.connect({
76
address: 'localhost:7233',
87
});
98
try {
10-
119
const x: WorkerOptions = {
1210
connection,
1311
namespace: 'default',
1412
taskQueue: 'hello-world',
1513
workflowsPath: require.resolve('./workflows'),
16-
activities
17-
}
14+
activities,
15+
};
1816

1917
const worker = await Worker.create(x);
2018

polling-frequent/src/workflows.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import type * as activities from './activities';
33

44
const activityOptions: ActivityOptions = {
55
startToCloseTimeout: 60 * 1000,
6-
heartbeatTimeout: 2 * 1000
7-
}
6+
heartbeatTimeout: 2 * 1000,
7+
};
88

99
const { greet } = proxyActivities<typeof activities>(activityOptions);
1010

1111
export async function example(name: string): Promise<string> {
12-
13-
let result = await greet(name);
14-
return result
12+
const result = await greet(name);
13+
return result;
1514
}

polling-infrequent/src/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { example } from './workflows';
33
import { nanoid } from 'nanoid';
44

55
async function run() {
6-
76
const connection = await Connection.connect({ address: 'localhost:7233' });
87

98
const client = new Client({

0 commit comments

Comments
 (0)