PostHog / posthog-node

Official PostHog Node library
MIT License
21 stars 19 forks source link

feat: rewrite library to leverage `undici` #64

Closed weyert closed 1 year ago

weyert commented 2 years ago

Changes

Rewrite the library to leverage undici instead of Axios

Added decorator approach for implementing the timeout and retry functionality of axios-retry for the fetch implementation of undici.

Improve memory usage of the posthog-node library by switching to undici

Updated the unit tests to use Jest

Checklist

weyert commented 2 years ago

Regarding the memory usage:

BEFORE PART 1 97mb 15:24:35 138mb 16:08:20 difference: 41mb 163mb 16:36:10 difference: 25mb 187mb 17:01:38 difference: 24mb 217mb 17:33:01 difference: 30mb 235mb 17:53:55 difference: 18mb 254mb 18:17:21 difference: 19mb

AFTER PART 2 woensdag 16 feb 178mb 18:22:08 difference: 0mb time: 0 177mb 18:30:00 difference: -1mb time: ~10m 178mb 18:40:53 difference: 1mb time: ~10m 179mb 18:53:53 difference: 1mb time: ~13m 181mb 19:19:18 difference: 2mb time: ~26m