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

Add custom WSDL cache option #1261

Merged
merged 1 commit into from
Nov 3, 2024
Merged

Conversation

millerdk12
Copy link
Contributor

Currently the library caches WSDLs for the lifetime of the process. This is not ideal for long running processes like a backend service that connect to many SOAP webservices.

Adding an option to override the current lifetime cache with a custom cache so user can bring their own cache, e.g. TTL or LRU. I had considered just disabling the cache using the existing option, but this is not also not ideal.

Code changes:

  • Adding IWSDLCache interface which can be extended with custom caching implementations
  • Added DefaultWSDLCache implementation which matches current caching handling, ie global singleton which indefinitely caches WSDLs.
  • Added options.wsdlCache to allow users to override the default cache.
  • Added test cases for default cache and overriding option.

I also tested with npm link against an existing application that uses node-soap. By adding ?v=1, ?v=2 and so on to the WSDL URL, you can simulate loading many different WSDLs. Setting max-old-space-size to something like 128, eventually the process will crash with the default cache. For my application, this occurred around 1000th WSDL with a 128mb limit. I updated to use a cache with a set max item limit and memory remained low and the process did not crash even when reaching the 1000 WSDL loaded mark.

* Adding IWSDLCache interface which can be extended with custom caching
  implementations
* Added DefaultWSDLCache implementation which matches current caching
  handling, ie global singleton which indefinitely caches WSDLs.
* Added options.wsdlCache to allow users to override the default cache.
* Added test cases for default cache and overriding option.
@w666
Copy link
Collaborator

w666 commented Nov 1, 2024

Hi @millerdk12,

Thanks for the improvement. I will include this into next release.

@millerdk12
Copy link
Contributor Author

Great, thanks for taking a look!

@w666 w666 merged commit 2122afd into vpulim:master Nov 3, 2024
1 check passed
@w666
Copy link
Collaborator

w666 commented Nov 3, 2024

@millerdk12 version 1.1.6 has been released

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

Successfully merging this pull request may close these issues.

2 participants