Open chillu opened 9 years ago
Agreed, this might make I nice set of features for a new version perhaps? @leighelse @joshkosmala it might be a good idea to tag this release of the module as an 0.1.0 (following semantic versioning). This makes it nice and easy for users to include in the project composer file and if you do another major version in the future it will help with the upgrade path. :+1:
+1 for triggering Tenon POST with onAfterPublish. Would also integrate better with dev and author workflows, instead of requiring someone to visit the page after it's published.
Looking at
tenon_post.js
, its an unconditional$.post()
. While not all of these cause an API request to Tenon, its still basically two hits to the server for every page visited. Particularly for heavily cached large sites in multi-server environments, that's not a great solution. It also assumes that the public web servers have access to dynamic services, which isn't always the case (e.g. for locked-down, statically published websites)Both for performance and security reasons, I would recommend triggering the tenon POST in onAfterPublish by default. Since its an external API request which can take a few seconds, this should probably use the https://github.com/silverstripe-australia/silverstripe-queuedjobs module.
In case you want to retain the
tenon_post.js
approach, I would suggest abstracting aTenonService
class fromTenonAjax
in order to make the logic more pluggable./cc @camfindlay