BuxOrg / bux

Bitcoin UTXO & xPub Management Engine
https://getbux.io
Apache License 2.0
36 stars 6 forks source link

chore(BUX-351): improve logging when requesting Pulse #549

Closed chris-4chain closed 9 months ago

chris-4chain commented 9 months ago

Pull Request Checklist

While doing this task, I discovered that, every time a request to our Pulse service is made, a new http.Client is created. I've change it - so that now, only one http.Client is created during the initialization stage.

From golang documentation:

A Client is an HTTP client. Its zero value (DefaultClient) is a usable client that uses DefaultTransport.

The Client's Transport typically has internal state (cached TCP connections), so Clients should be reused instead of created as needed. Clients are safe for concurrent use by multiple goroutines.

mergify[bot] commented 9 months ago

Welcome to our open-source project @chris-4chain! πŸ’˜

codecov[bot] commented 9 months ago

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (a011827) 53.28% compared to head (97b5bd1) 53.89%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/BuxOrg/bux/pull/549/graphs/tree.svg?width=650&height=150&src=pr&token=gh8XH5lven&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg)](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg) ```diff @@ Coverage Diff @@ ## master #549 +/- ## ========================================== + Coverage 53.28% 53.89% +0.60% ========================================== Files 110 110 Lines 10854 10853 -1 ========================================== + Hits 5784 5849 +65 + Misses 4605 4533 -72 - Partials 465 471 +6 ``` | [Flag](https://app.codecov.io/gh/BuxOrg/bux/pull/549/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg) | Coverage Ξ” | | |---|---|---| | [unittests](https://app.codecov.io/gh/BuxOrg/bux/pull/549/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg) | `53.89% <83.33%> (+0.60%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg) | Coverage Ξ” | | |---|---|---| | [chainstate/client.go](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg#diff-Y2hhaW5zdGF0ZS9jbGllbnQuZ28=) | `65.95% <ΓΈ> (ΓΈ)` | | | [chainstate/client\_options.go](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg#diff-Y2hhaW5zdGF0ZS9jbGllbnRfb3B0aW9ucy5nbw==) | `74.25% <100.00%> (+3.96%)` | :arrow_up: | | [chainstate/merkle\_root.go](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg#diff-Y2hhaW5zdGF0ZS9tZXJrbGVfcm9vdC5nbw==) | `83.33% <100.00%> (+83.33%)` | :arrow_up: | | [chainstate/merkle\_root\_provider.go](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg#diff-Y2hhaW5zdGF0ZS9tZXJrbGVfcm9vdF9wcm92aWRlci5nbw==) | `66.66% <80.00%> (+66.66%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/BuxOrg/bux/pull/549/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg) > `Ξ” = absolute (impact)`, `ΓΈ = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg). Last update [a011827...97b5bd1](https://app.codecov.io/gh/BuxOrg/bux/pull/549?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BuxOrg).