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.

Wait doesn't seem to work

See original GitHub issue

I have the below code which has a Wait call().

When I call start I’d expect that to block until the Wait delegate had succeeded but this isn’t the case. Despite this if I put a breakpoint on the delegate it never gets hit. Any ideas? Thanks

        protected override Task OnStart(CancellationToken cancellationToken)
        {
            try
            {
                this.Logger.LogInformation("Starting MS SQL Server container. This may take a few minutes if the image is not in local cache.");

                this.containerService = new Builder()
                    .UseContainer()
                    .WithName("profiles-sql-server")
                    .UseImage("mcr.microsoft.com/mssql/server:2017-latest-ubuntu")
                    .WithEnvironment("ACCEPT_EULA=Y", $"SA_PASSWORD={SAPassword}", "MSSQL_MEMORY_LIMIT_MB=4000")
                    .ReuseIfExists()
                    .ExposePort(21433, 1433)
                    //.WaitForPort("1433/tcp", 5000)
                    .Wait("profiles-sql-server", (service, count) =>
                    {
                        if (count > 10)
                        {
                            throw new FluentDockerException("Failed to wait for sql server");
                        }

                        using (var connection = new SqlConnection(CreateMasterConnectionStringBuilder().ConnectionString))
                        {
                            try
                            {
                                connection.Open();
                                return 0; //Zero and below means success
                            }
                            catch (Exception)
                            {
                                return 500; //The time to wait until next execution
                            }
                        }
                    })
                    .Build();

                this.containerService.Start();
            }
            catch (FluentDockerException ex) when (ex.Message.Contains("Error response from daemon: Conflict"))
            {
                this.Logger.LogInformation("MS SQL Server container already running.");
            }

            return Task.CompletedTask;
        }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jchannoncommented, Jun 3, 2019

Have just tried the new release and seems well!

Thanks a lot!

On Fri, 31 May 2019 at 14:50, Mario Toffia notifications@github.com wrote:

@jchannon https://github.com/jchannon Can you have a go on your code with the v2.6.8 and see if it fixes your case? So I may close this if it works.

Cheers, Mario

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mariotoffia/FluentDocker/issues/86?email_source=notifications&email_token=AAAZVJXR5JG6FRANCIKUHOTPYEUKDA5CNFSM4HRFVHH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWVIVKA#issuecomment-497715880, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAZVJRB7SKMPJSZVKF2FZLPYEUKDANCNFSM4HRFVHHQ .

1reaction
yreynhoutcommented, May 31, 2019

@jchannon they are independent in the sense that you register them one after the other, but upon starting the container, from reading the code, they seem to be executed as a sequence. Meaning, first WaitForPort then WaitForLambda.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Selenium Wait not working / Java Selenium Question
1 Try not to mix implicit and explicit waits. It can lead to unpredictable wait periods. Check here for more info.
Read more >
C# WaitForSeconds doesn't seem to work
Hello everyone, I'm trying to write a script that when the player looses, an animation is displayed (it's an explosion) then the function ......
Read more >
Wait command works when pid doesn't exists
Run wait with no argument to remove finished jobs from the job table, and you'll see that you can no longer retrieve the...
Read more >
wait /d - not working on window 10 and windows 2019 server
I am trying to create script that launches notpad.exe, waits till it closes, then runs one final command. Based on my research, I...
Read more >
Wait=true does not appear to be working as intended... #109
I tested with a simple namespace creation/deletion. Here's the terraform destroy for the namespace resource. ➜ tf apply plan.tfplan module.
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