File tree 3 files changed +5
-4
lines changed
main/java/org/example/myapp/async
test/java/org/example/myapp/async
3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,6 @@ public BackgroundBean(@Nullable AtomicInteger intyAtomic) throws InterruptedExce
26
26
intyAtomic .incrementAndGet ();
27
27
}
28
28
29
- Thread .sleep (1200 );
29
+ Thread .sleep (200 );
30
30
}
31
31
}
Original file line number Diff line number Diff line change 1
1
package org .example .myapp .async ;
2
2
3
+ import io .avaje .inject .AsyncBean ;
3
4
import io .avaje .inject .Component ;
4
5
import jakarta .inject .Named ;
5
6
6
- // @AsyncBean
7
+ @ AsyncBean
7
8
@ Component
8
9
public class MyUseOfBackground {
9
10
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ void test() {
19
19
try (var scope = BeanScope .builder ().bean (AtomicInteger .class , inty ).build ()) {
20
20
21
21
// the async beans shouldn't slowdown initialization
22
- assertThat (Duration .between (start , Instant .now ()).toMillis ()).isLessThan (1000 );
22
+ assertThat (Duration .between (start , Instant .now ()).toMillis ()).isLessThan (300 );
23
23
24
24
// prove it's not just lazy
25
25
var beforeGet = Instant .now ();
@@ -36,7 +36,7 @@ void testFactory() {
36
36
var inty = new AtomicInteger ();
37
37
try (var scope = BeanScope .builder ().bean (AtomicInteger .class , inty ).build ()) {
38
38
// the async beans shouldn't slowdown initialization
39
- assertThat (Duration .between (start , Instant .now ()).toMillis ()).isLessThan (1000 );
39
+ assertThat (Duration .between (start , Instant .now ()).toMillis ()).isLessThan (300 );
40
40
41
41
var bean = scope .get (BackgroundBean .class , "factory" );
42
42
// this works on my local but not on the CI for some unknown reason.
You can’t perform that action at this time.
0 commit comments