Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gateway's AsyncPush can not work #272

Closed
AndyRao opened this issue May 6, 2019 · 3 comments
Closed

Gateway's AsyncPush can not work #272

AndyRao opened this issue May 6, 2019 · 3 comments

Comments

@AndyRao
Copy link

AndyRao commented May 6, 2019

Hi
I'm trying to use gateway's AsyncPush and I replaced gateway.Push() in sample_client.cc with async one like this.

   std::future<int> returnCodeFuture = gateway.AsyncPush();
    std::future_status status = returnCodeFuture.wait_for(std::chrono::seconds(10));
    if (status == std::future_status::timeout) {
      std::cout << "push gateway timeout  ";
    } else if (status == std::future_status::ready) {
      int returnCode = returnCodeFuture.get();
      if (returnCode != 200) {
        std::cout << "push counter to pushgateway failed " << "return code is: " << returnCode;
      }
      std::cout << "returnCode is " << returnCode << std::endl;

    }

But when I executed this code, I got a segment fault. I don't know why. Is there any examples about asyn push that can work?

@gjasny
Copy link
Collaborator

gjasny commented May 6, 2019

I can reproduce it and will take a look.

@gjasny
Copy link
Collaborator

gjasny commented May 6, 2019

@AndyRao please test #273

@AndyRao
Copy link
Author

AndyRao commented May 9, 2019

@gjasny test pass

@gjasny gjasny closed this as completed in 5d7f4b2 May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants