-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Implement periodic ping functionality #3246
Conversation
allows periodically sending a POST request to one or more URL specified by COMPANION_PERIODIC_PING_URLS also add nock for easier testing
// Run requests in parallel | ||
await Promise.all(urls.map(async (url) => { | ||
try { | ||
// TODO rewrite to use a non-deprecated request library |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would like to post a key that is set via environment, then we can hand out such random keys and recognize customers by them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we agree to have the key as part of the URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, may have but i don't recall 🤔
URLs leak more easily though. They end up in all kinds of logs and post payloads less so/often.
And i could imagine that at one point we not only want to share
client_key: uuidhash
but also
load: 0.4
mem: 1555
connections: 80
environment: production
cores: 4
etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Sure, I'll add a post payload. I think JSON should be good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 👌👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COMPANION_PERIODIC_PING_STATIC_JSON_PAYLOAD='{"key": "value"}'
should work now
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
COMPANION_PERIODIC_PING_STATIC_JSON_PAYLOAD
# Conflicts: # package-lock.json # packages/@uppy/companion/package.json # packages/@uppy/companion/src/companion.js
accidentally added during merge
by default to periodic ping when enabled
@mifi can this be merged? |
Yup! |
| Package | Version | Package | Version | | ------------------------- | ------- | ------------------------- | ------- | | @uppy/companion | 3.2.0 | @uppy/provider-views | 2.0.7 | | @uppy/companion-client | 2.0.5 | @uppy/thumbnail-generator | 2.1.0 | | @uppy/core | 2.1.5 | @uppy/robodog | 2.3.0 | | @uppy/dashboard | 2.1.4 | uppy | 2.5.0 | | @uppy/locales | 2.0.6 | | | - @uppy/companion: add support for COMPANION_UNSPLASH_SECRET (Mikael Finstad / #3463) - @uppy/unsplash: fix nested meta (Artur Paikin / #3485) - meta: fix(docs): typo in property `thumbnailType` (Dan Schalow / #3472) - @uppy/robodog: add audio, box, unsplash, screen-capture to Robodog (Artur Paikin / #3483) - meta: consolidate ENV files and fix contributing guidelines (Antoine du Hamel / #3475) - @uppy/companion-client,@uppy/companion,@uppy/provider-views,@uppy/robodog: Finishing touches on Companion dynamic Oauth (Renée Kooi / #2802) - meta: Improve companion docs (Mikael Finstad / #3479) - meta: Make E2E Great Again (Merlijn Vos / #3444) - meta: Add PostCSS handling to Vite (Artur Paikin / #3467) - meta: Update CONTRIBUTING.md (Mikael Finstad / #3411) - @uppy/companion: fix broken thumbnails for box and dropbox (Mikael Finstad / #3460) - website: fix `Uppy is not defined` error (Antoine du Hamel / #3461) - @uppy/companion: Implement periodic ping functionality (Mikael Finstad / #3246) - @uppy/companion: fix callback urls (Mikael Finstad / #3458) - @uppy/core,@uppy/dashboard,@uppy/thumbnail-generator: Add dashboard and UIPlugin types (Merlijn Vos / #3426) - @uppy/locales: Add "save" to fr_FR.js (Charly Billaud / #3395) - @uppy/companion: Fix TypeError when invalid initialization vector (Julian Gruber / #3416) - meta: Upgrade size-limit to 7.0.5 (Artur Paikin / #3445) - @uppy/provider-views: Unsplash: UI improvements (Artur Paikin / #3438) - @uppy/thumbnail-generator: exifr: remove legacy IE support (Artur Paikin / #3382) - @uppy/companion: Default to HEAD requests when the Companion looks to get meta information about a URL (Zack Bloom / #3417) - @uppy/dashboard: check if info array is empty (Artur Paikin / #3442) - meta: dev: fix Vite custom plugin (Antoine du Hamel / #3437) - website: add legacy bundle to CDN example (Antoine du Hamel / #3433) - meta: remove unused lerna and npm files (Antoine du Hamel / #3436) - meta: replace browserify with esbuild (Antoine du Hamel / #3363)
* Implement periodic ping functionality allows periodically sending a POST request to one or more URL specified by COMPANION_PERIODIC_PING_URLS also add nock for easier testing * Update packages/@uppy/companion/src/companion.js Co-authored-by: Merlijn Vos <merlijn@soverin.net> * Update packages/@uppy/companion/src/server/jobs.js * allow posting a JSON body COMPANION_PERIODIC_PING_STATIC_JSON_PAYLOAD * add todo * remove package-lock accidentally added during merge * Add version and processId by default to periodic ping when enabled Co-authored-by: Merlijn Vos <merlijn@soverin.net>
| Package | Version | Package | Version | | ------------------------- | ------- | ------------------------- | ------- | | @uppy/companion | 3.2.0 | @uppy/provider-views | 2.0.7 | | @uppy/companion-client | 2.0.5 | @uppy/thumbnail-generator | 2.1.0 | | @uppy/core | 2.1.5 | @uppy/robodog | 2.3.0 | | @uppy/dashboard | 2.1.4 | uppy | 2.5.0 | | @uppy/locales | 2.0.6 | | | - @uppy/companion: add support for COMPANION_UNSPLASH_SECRET (Mikael Finstad / transloadit#3463) - @uppy/unsplash: fix nested meta (Artur Paikin / transloadit#3485) - meta: fix(docs): typo in property `thumbnailType` (Dan Schalow / transloadit#3472) - @uppy/robodog: add audio, box, unsplash, screen-capture to Robodog (Artur Paikin / transloadit#3483) - meta: consolidate ENV files and fix contributing guidelines (Antoine du Hamel / transloadit#3475) - @uppy/companion-client,@uppy/companion,@uppy/provider-views,@uppy/robodog: Finishing touches on Companion dynamic Oauth (Renée Kooi / transloadit#2802) - meta: Improve companion docs (Mikael Finstad / transloadit#3479) - meta: Make E2E Great Again (Merlijn Vos / transloadit#3444) - meta: Add PostCSS handling to Vite (Artur Paikin / transloadit#3467) - meta: Update CONTRIBUTING.md (Mikael Finstad / transloadit#3411) - @uppy/companion: fix broken thumbnails for box and dropbox (Mikael Finstad / transloadit#3460) - website: fix `Uppy is not defined` error (Antoine du Hamel / transloadit#3461) - @uppy/companion: Implement periodic ping functionality (Mikael Finstad / transloadit#3246) - @uppy/companion: fix callback urls (Mikael Finstad / transloadit#3458) - @uppy/core,@uppy/dashboard,@uppy/thumbnail-generator: Add dashboard and UIPlugin types (Merlijn Vos / transloadit#3426) - @uppy/locales: Add "save" to fr_FR.js (Charly Billaud / transloadit#3395) - @uppy/companion: Fix TypeError when invalid initialization vector (Julian Gruber / transloadit#3416) - meta: Upgrade size-limit to 7.0.5 (Artur Paikin / transloadit#3445) - @uppy/provider-views: Unsplash: UI improvements (Artur Paikin / transloadit#3438) - @uppy/thumbnail-generator: exifr: remove legacy IE support (Artur Paikin / transloadit#3382) - @uppy/companion: Default to HEAD requests when the Companion looks to get meta information about a URL (Zack Bloom / transloadit#3417) - @uppy/dashboard: check if info array is empty (Artur Paikin / transloadit#3442) - meta: dev: fix Vite custom plugin (Antoine du Hamel / transloadit#3437) - website: add legacy bundle to CDN example (Antoine du Hamel / transloadit#3433) - meta: remove unused lerna and npm files (Antoine du Hamel / transloadit#3436) - meta: replace browserify with esbuild (Antoine du Hamel / transloadit#3363)
allows periodically sending a POST request to one or more URL
specified by COMPANION_PERIODIC_PING_URLS
also add nock for easier testing