puppetlabs / puppet-editor-services

Puppet Language Server for editors
Apache License 2.0
45 stars 21 forks source link

(GH-245) Use object cache for fact data #246

Closed glennsarti closed 4 years ago

glennsarti commented 4 years ago

Fixes #245

This commit adds an acceptance test for the puppet/getFacts request. Previously this message was added to the message handler, but not to the test suite.


Previously the puppet/getFacts request would call out to Facter directly however this can be very slow, particularly with Facter v2 in the PDK. This commit changes the request to instead use the object cache which already has all of the available facter information.

This commit also moves the method from the PuppetHelper to the FacterHelper where it would make more sense. This is tested as part of the acceptance suite.


Now that the language server no longer calls the facts_all action, the supporting code can be removed.

jpogran commented 4 years ago

The primary reason I had not pulled from cache was that it means waiting for the language server to start and for the language server to run before querying, but I was able to set the promises in the client to wait. It works, and is slightly faster start because there isn't a second wait for the facts to be queried.

So it all works with cached facts. However, hitting refresh doesn't 'refresh' anymore. It pulls from teh cache. How does a user get a 'fresh' run?

jpogran commented 4 years ago

Created new issue to addressed refreshing facts. It is sufficient for the first version of this feature to simply have it refresh from cache