Coder Social home page Coder Social logo

Hangs before exit about pub_api_client HOT 9 CLOSED

leoafarias avatar leoafarias commented on September 21, 2024
Hangs before exit

from pub_api_client.

Comments (9)

vlidholt avatar vlidholt commented on September 21, 2024 2

I'm having the same issue.

from pub_api_client.

f3ath avatar f3ath commented on September 21, 2024 1

The example code can be used to replicate the issue. The following code hangs for me even with the close() call.

import 'package:pub_api_client/pub_api_client.dart';

void main() async {
  final client = PubClient();
  final packageScore = await client.packageScore('fvm');
  client.close();
  print('Package Score: $packageScore');
}

from pub_api_client.

mschwartz avatar mschwartz commented on September 21, 2024

BTW, thanks for this package. It's quite useful.

from pub_api_client.

leoafarias avatar leoafarias commented on September 21, 2024

@mschwartz did you try calling close on the client?

You can do the following way.

  final client = PubClient();
  final packageScore = await client.packageInfo('provider');
  client.client?.close();

from pub_api_client.

mschwartz avatar mschwartz commented on September 21, 2024

I can do that, thanks.

You still might consider adding a close() method on the PubClient that does the client?close(). If we use that new close() method and you later implement code that requires more cleanup, we all get it for free.

Again, thanks for this package!

from pub_api_client.

mschwartz avatar mschwartz commented on September 21, 2024

Thanks for adding the close method.

However, the issue persists even with calling client.client?.close().

If I comment out the line that calls client.anymethod(), the program exits immediately. Otherwise there's a several second pause at the end.

I've tried creating the client and closing it for each method call as well as one global client that I reuse and close before program is finished.

I could call exit(), but you might want to investigate this (or not :))

from pub_api_client.

leoafarias avatar leoafarias commented on September 21, 2024

@mschwartz based on my research it seems there are some open issues in regards to the HttpClient, some even point at malformed responses, so I am not 100% sure if this something that needs to be fixed on pub_api_client

Did you fix to close after each method work?

from pub_api_client.

mschwartz avatar mschwartz commented on September 21, 2024

Close after each method did not solve the problem. I tried both ways: create, query, close, and create, query, query….

from pub_api_client.

leoafarias avatar leoafarias commented on September 21, 2024

Not being able to replicate this. If there is a sample code that I can use to replicate it would be great

from pub_api_client.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.