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

Sign up
Appearance settings

Commit 3baf80b

Browse files
committed
Fix the bug, data not loaded sometimes:
- Delete and create operations are async. - They may not be executed in consecutive order. - SOLUTION: one.THEN(other)...
1 parent 2b72ffa commit 3baf80b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

‎src/main/java/com/nihat/springwebfluxdemo/bootstrap/DataLoader.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ public class DataLoader implements CommandLineRunner {
1818
@Override
1919
public void run(String... args) throws Exception {
2020

21-
productRepository.deleteAll().subscribe();
22-
23-
productRepository.count()
21+
productRepository.deleteAll()
22+
.then(productRepository.count())
2423
.subscribe(count -> {
2524
if (count == 0) {
2625
loadProducts();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /