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

Sleep w/ Polling #30661

Merged
merged 32 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
92c417d
add polling mechanism to sleep upon crossing polling_threshold
DeanArbel Nov 5, 2023
4de8dae
add default polling_threshold when none is provided
DeanArbel Nov 7, 2023
23ec7b9
Merge branch 'master' into da_CRTX_94851_polling_sleep
DeanArbel Nov 7, 2023
4601f1e
add SleepCompletePolling and removed new args from Sleep
DeanArbel Nov 13, 2023
b258aa6
Merge branch 'master' into da_CRTX_94851_polling_sleep
DeanArbel Nov 13, 2023
f6bfe7c
Merge branch 'master' into da_CRTX_94851_polling_sleep
DeanArbel Nov 13, 2023
127bae1
added RN
DeanArbel Nov 21, 2023
5f83bc2
Merge branch 'master' into da_CRTX_94851_polling_sleep
DeanArbel Nov 21, 2023
ba36ff3
updated version and name
DeanArbel Nov 21, 2023
4ebafaf
Merged master into current branch.
Nov 22, 2023
34978e3
Bump pack from version CommonScripts to 1.12.46.
Nov 22, 2023
b44a3c7
Merged master into current branch.
Nov 22, 2023
5c1b707
Bump pack from version CommonScripts to 1.12.47.
Nov 22, 2023
fc3f1e2
Merged master into current branch.
Nov 26, 2023
66784a6
Bump pack from version CommonScripts to 1.12.48.
Nov 26, 2023
389dffb
Merged master into current branch.
Nov 26, 2023
38f651a
Bump pack from version CommonScripts to 1.12.49.
Nov 26, 2023
bcd4d5d
Merge branch 'master' into da_CRTX_94851_polling_sleep
DeanArbel Nov 27, 2023
41a5966
add getServerConfig usage
DeanArbel Nov 27, 2023
c241286
updated RN
DeanArbel Nov 27, 2023
21bcb23
Update Packs/CommonScripts/ReleaseNotes/1_12_49.md
DeanArbel Nov 27, 2023
5542ee0
Merged master into current branch.
Nov 27, 2023
a673ba4
Bump pack from version CommonScripts to 1.12.50.
Nov 27, 2023
0a525e7
Update Packs/CommonScripts/ReleaseNotes/1_12_50.md
DeanArbel Nov 27, 2023
409b78b
changed code standard to match js standards
DeanArbel Nov 27, 2023
ecfaf0f
Merge remote-tracking branch 'origin/da_CRTX_94851_polling_sleep' int…
DeanArbel Nov 27, 2023
e787da9
Update Packs/CommonScripts/ReleaseNotes/1_12_50.md
DeanArbel Nov 28, 2023
3a65517
Merge branch 'master' into da_CRTX_94851_polling_sleep
DeanArbel Nov 28, 2023
83f80e7
Merge remote-tracking branch 'origin/da_CRTX_94851_polling_sleep' int…
DeanArbel Nov 28, 2023
b6ea6e1
validate
DeanArbel Nov 28, 2023
c549207
Merged master into current branch.
Nov 28, 2023
bf0cdcf
Bump pack from version CommonScripts to 1.12.51.
Nov 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Packs/CommonScripts/ReleaseNotes/1_12_49.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Scripts

##### Sleep

- For SaaS based platforms, when the sleep seconds is greater than the configured default (5 minutes by default), the sleep will now use a polling task instead of actively sleep. This change should have no effect on existing content, but will improve the system performance for long sleeps.
DeanArbel marked this conversation as resolved.
Show resolved Hide resolved
22 changes: 22 additions & 0 deletions Packs/CommonScripts/Scripts/Sleep/Sleep.js
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
polling_threshold = 300;

if (isDemistoVersionGE('8.4.0', 649563)) {
config_threshold = executeCommand('getServerConfig', {key: 'content.automation.sleep.threshold.seconds'});
if (config_threshold[0] && !isError(config_threshold[0])) {
polling_threshold = parseInt(config_threshold[0].Contents);
}
}

if (parseInt(args.seconds) >= polling_threshold) {
// Polling implementation
return {
Type: entryTypes.note,
Contents: 'Sleep will complete in ' + args.seconds + ' seconds',
PollingCommand: 'Print',
NextRun: args.seconds,
PollingArgs: {value: 'Sleep completed in ' + args.seconds + ' seconds'},
Timeout: String(parseInt(args.seconds) + 60)
}
}

// Sleep for the given number of seconds
wait(parseInt(args.seconds));
1 change: 1 addition & 0 deletions Packs/CommonScripts/Scripts/Sleep/Sleep.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
commonfields:

Check failure on line 1 in Packs/CommonScripts/Scripts/Sleep/Sleep.yml

View workflow job for this annotation

GitHub Actions / pre-commit

Validation Error CJ105

Either Sleep does not have any test playbooks or that all test playbooks in this pack are currently skipped, and there is no unittests file to be found. Please create a test playbook or un-skip at least one of the relevant test playbooks. You can un-skip a playbook by deleting the line relevant to one of the test playbooks from the 'skipped_tests' section inside the conf.json file and deal with the matching issue, or create a new active test playbook and add the id to the 'tests' field in the yml.

Check failure on line 1 in Packs/CommonScripts/Scripts/Sleep/Sleep.yml

View workflow job for this annotation

GitHub Actions / pre-commit

Validation Error DS108

Description must end with a period ("."), fix the following: The argument seconds description should end with a period. The comment field should end with a period. To fix the problem, try running `demisto-sdk format -i Packs/CommonScripts/Scripts/Sleep/Sleep.yml `
id: Sleep
version: -1
name: Sleep
Expand All @@ -14,5 +14,6 @@
default: true
description: Amount of seconds to sleep
scripttarget: 0
polling: true
timeout: 1h40m0s
fromversion: 5.0.0
2 changes: 1 addition & 1 deletion Packs/CommonScripts/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Common Scripts",
"description": "Frequently used scripts pack.",
"support": "xsoar",
"currentVersion": "1.12.48",
"currentVersion": "1.12.49",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down