Skip to content

Commit 9c8e796

Browse files
Apply changes from ktLintFormat
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 9365e5e commit 9c8e796

File tree

3 files changed

+112
-61
lines changed

3 files changed

+112
-61
lines changed

workflow-runtime/src/commonMain/kotlin/com/squareup/workflow1/RenderWorkflow.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ public fun <PropsT, OutputT, RenderingT> renderWorkflowIn(
121121

122122
val dispatcher = if (RuntimeConfigOptions.WORK_STEALING_DISPATCHER in runtimeConfig) {
123123
WorkStealingDispatcher.wrapDispatcherFrom(scope.coroutineContext)
124-
} else null
124+
} else {
125+
null
126+
}
125127

126128
@Suppress("NAME_SHADOWING")
127129
val scope = dispatcher?.let { scope + dispatcher } ?: scope

workflow-runtime/src/commonMain/kotlin/com/squareup/workflow1/internal/WorkStealingDispatcher.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ internal class WorkStealingDispatcher(
166166
onFinishedLocked = {
167167
// If we set this flag above, then clear it now so future dispatch calls schedule normally.
168168
dispatchScheduled = wasDispatchScheduled
169-
})
169+
}
170+
)
170171
}
171172

172173
/**

workflow-runtime/src/commonTest/kotlin/com/squareup/workflow1/internal/WorkStealingDispatcherTest.kt

Lines changed: 107 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,35 @@ class WorkStealingDispatcherTest {
1919
val dispatcher = WorkStealingDispatcher(Dispatchers.Unconfined)
2020

2121
expect(0)
22-
dispatcher.dispatch(dispatcher, Runnable {
23-
expect(1)
24-
})
22+
dispatcher.dispatch(
23+
dispatcher,
24+
Runnable {
25+
expect(1)
26+
}
27+
)
2528
expect(2)
2629
}
2730

2831
@Test fun dispatchNested_enqueuesWhenDelegateIsUnconfined() {
2932
val dispatcher = WorkStealingDispatcher(Dispatchers.Unconfined)
3033

3134
expect(0)
32-
dispatcher.dispatch(dispatcher, Runnable {
33-
expect(1)
34-
35-
// This dispatch should get enqueued to Unconfined's threadlocal queue.
36-
dispatcher.dispatch(dispatcher, Runnable {
37-
expect(3)
38-
})
39-
40-
expect(2)
41-
})
35+
dispatcher.dispatch(
36+
dispatcher,
37+
Runnable {
38+
expect(1)
39+
40+
// This dispatch should get enqueued to Unconfined's threadlocal queue.
41+
dispatcher.dispatch(
42+
dispatcher,
43+
Runnable {
44+
expect(3)
45+
}
46+
)
47+
48+
expect(2)
49+
}
50+
)
4251

4352
expect(4)
4453
}
@@ -48,9 +57,12 @@ class WorkStealingDispatcherTest {
4857
val dispatcher = WorkStealingDispatcher(testDispatcher)
4958

5059
expect(0)
51-
dispatcher.dispatch(dispatcher, Runnable {
52-
expect(2)
53-
})
60+
dispatcher.dispatch(
61+
dispatcher,
62+
Runnable {
63+
expect(2)
64+
}
65+
)
5466
expect(1)
5567

5668
testDispatcher.scheduler.advanceUntilIdle()
@@ -62,13 +74,19 @@ class WorkStealingDispatcherTest {
6274
val dispatcher = WorkStealingDispatcher(testDispatcher)
6375

6476
expect(0)
65-
dispatcher.dispatch(dispatcher, Runnable {
66-
expect(3)
67-
})
77+
dispatcher.dispatch(
78+
dispatcher,
79+
Runnable {
80+
expect(3)
81+
}
82+
)
6883
expect(1)
69-
dispatcher.dispatch(dispatcher, Runnable {
70-
expect(4)
71-
})
84+
dispatcher.dispatch(
85+
dispatcher,
86+
Runnable {
87+
expect(4)
88+
}
89+
)
7290
expect(2)
7391

7492
testDispatcher.scheduler.advanceUntilIdle()
@@ -80,19 +98,28 @@ class WorkStealingDispatcherTest {
8098
val dispatcher = WorkStealingDispatcher(testDispatcher)
8199

82100
expect(0)
83-
dispatcher.dispatch(dispatcher, Runnable {
84-
expect(2)
85-
dispatcher.dispatch(dispatcher, Runnable {
86-
expect(5)
87-
})
101+
dispatcher.dispatch(
102+
dispatcher,
103+
Runnable {
104+
expect(2)
105+
dispatcher.dispatch(
106+
dispatcher,
107+
Runnable {
108+
expect(5)
109+
}
110+
)
88111

89-
expect(3)
112+
expect(3)
90113

91-
dispatcher.dispatch(dispatcher, Runnable {
92-
expect(6)
93-
})
94-
expect(4)
95-
})
114+
dispatcher.dispatch(
115+
dispatcher,
116+
Runnable {
117+
expect(6)
118+
}
119+
)
120+
expect(4)
121+
}
122+
)
96123
expect(1)
97124

98125
testDispatcher.scheduler.advanceUntilIdle()
@@ -164,12 +191,18 @@ class WorkStealingDispatcherTest {
164191
val dispatcher = WorkStealingDispatcher(testDispatcher)
165192

166193
expect(0)
167-
dispatcher.dispatch(dispatcher, Runnable {
168-
expect(2)
169-
})
170-
dispatcher.dispatch(dispatcher, Runnable {
171-
expect(3)
172-
})
194+
dispatcher.dispatch(
195+
dispatcher,
196+
Runnable {
197+
expect(2)
198+
}
199+
)
200+
dispatcher.dispatch(
201+
dispatcher,
202+
Runnable {
203+
expect(3)
204+
}
205+
)
173206
expect(1)
174207

175208
dispatcher.advanceUntilIdle()
@@ -181,13 +214,19 @@ class WorkStealingDispatcherTest {
181214
val dispatcher = WorkStealingDispatcher(testDispatcher)
182215

183216
expect(0)
184-
dispatcher.dispatch(dispatcher, Runnable {
185-
expect(2)
186-
dispatcher.dispatch(dispatcher, Runnable {
187-
expect(4)
188-
})
189-
expect(3)
190-
})
217+
dispatcher.dispatch(
218+
dispatcher,
219+
Runnable {
220+
expect(2)
221+
dispatcher.dispatch(
222+
dispatcher,
223+
Runnable {
224+
expect(4)
225+
}
226+
)
227+
expect(3)
228+
}
229+
)
191230
expect(1)
192231

193232
dispatcher.advanceUntilIdle()
@@ -199,21 +238,30 @@ class WorkStealingDispatcherTest {
199238
val dispatcher = WorkStealingDispatcher(testDispatcher)
200239

201240
expect(0)
202-
dispatcher.dispatch(dispatcher, Runnable {
203-
expect(2)
204-
dispatcher.dispatch(dispatcher, Runnable {
205-
expect(4)
206-
})
207-
expect(3)
241+
dispatcher.dispatch(
242+
dispatcher,
243+
Runnable {
244+
expect(2)
245+
dispatcher.dispatch(
246+
dispatcher,
247+
Runnable {
248+
expect(4)
249+
}
250+
)
251+
expect(3)
208252

209-
dispatcher.advanceUntilIdle()
253+
dispatcher.advanceUntilIdle()
210254

211-
expect(5)
212-
dispatcher.dispatch(dispatcher, Runnable {
213-
expect(7)
214-
})
215-
expect(6)
216-
})
255+
expect(5)
256+
dispatcher.dispatch(
257+
dispatcher,
258+
Runnable {
259+
expect(7)
260+
}
261+
)
262+
expect(6)
263+
}
264+
)
217265
expect(1)
218266

219267
dispatcher.advanceUntilIdle()

0 commit comments

Comments
 (0)