question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom action while await

See original GitHub issue

hi! Thank you very much for the tool, it’s very useful!

could you tell me, is it possible to do some custom action while condition waiting? something like this:

// Publish an asynchronous event:
publishEvent(updateCustomerStatusEvent);
// Awaitility lets you wait until the asynchronous operation completes:
await()
    .atMost(5, SECONDS)
    .do(() -> pollEvent())
    .until(customerStatusIsUpdated());

and i expect that the method pollEvent() will be called by awaitility before check the condition.

now i use

// Publish an asynchronous event:
publishEvent(updateCustomerStatusEvent);
// Awaitility lets you wait until the asynchronous operation completes:
await()
    .atMost(5, SECONDS)
    .until(() -> {
        pollEvent(); 
        customerStatusIsUpdated()
    });

but it’s not elegant )

of course the method pollEvent should be non-blocking

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tko007commented, Jan 7, 2020

Hi I have created PR for this issue. I am agree with @johanhaleby that is should not be exposed in the API and later on moved to a separate module. I have created to sample building block andThen and andBefore as a first draft. (still in WIP waiting for feedback)

0reactions
grofolicommented, Jan 10, 2020

@johanhaleby IMHO, it is not really worth to add that complexity…

Read more comments on GitHub >

github_iconTop Results From Across the Web

WIX C# custom actions with async await - Stack Overflow
I tried to make CheckDbConfig not async and use Task.WaitAll(tasks, 10000) and it worked. But when I use Task.WaitAll(tasks) without time, ...
Read more >
Async actions in bare Redux with Thunk or custom middleware
Learn how to manage asynchronous actions in React apps with Redux Toolkit, or a bare Redux implementation with custom middleware.
Read more >
await anything; - .NET Parallel Programming
The second approach to making an awaitable type is to implement a custom awaiter. This could either be a separate type that's returned...
Read more >
Developing Custom Gradle Task Types
await () method. Note that Gradle will only begin running other independent tasks in parallel when a task has exited a task action...
Read more >
createAsyncThunk - Redux Toolkit
payloadCreator ​ · arg : a single value, containing the first parameter that was passed to the thunk action creator when it was...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found