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

test memory dump #36367

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Packs/Slack/Integrations/SlackV3/SlackV3.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from slack_sdk.web.async_client import AsyncWebClient
from slack_sdk.web.async_slack_response import AsyncSlackResponse
from slack_sdk.web.slack_response import SlackResponse
import signal

''' CONSTANTS '''

Expand Down Expand Up @@ -1830,6 +1831,8 @@ def slack_send():
Sends a message to slack
"""

os.kill(os.getpid(), signal.SIGUSR1)

args = demisto.args()
message = args.get('message', '')
to = args.get('to')
Expand All @@ -1845,6 +1848,8 @@ def slack_send():
blocks = args.get('blocks')
entry_object = args.get('entryObject') # From server, available from demisto v6.1 and above
entitlement = ''
demisto.info(" # Log memory status after initial argument extraction")
os.kill(os.getpid(), signal.SIGUSR1)

if message_type and (message_type not in PERMITTED_NOTIFICATION_TYPES) and message_type != MIRROR_TYPE:
demisto.info(f"Message type is not in permitted options. Received: {message_type}")
Expand Down Expand Up @@ -1899,6 +1904,8 @@ def slack_send():

if not (to or group or channel or channel_id):
return_error('Either a user, group, channel id, or channel must be provided.')
demisto.info(" # Log memory status after channel and severity checks")
os.kill(os.getpid(), signal.SIGUSR1)

reply = ''
expiry = ''
Expand Down Expand Up @@ -1928,9 +1935,13 @@ def slack_send():
except Exception:
demisto.info('Slack - could not parse JSON from entitlement message.')

demisto.info("# Log memory status before sending the Slack request")
os.kill(os.getpid(), signal.SIGUSR1)
response = slack_send_request(to, channel, group, entry, ignore_add_url, thread_id, message=message, blocks=blocks,
channel_id=channel_id)

demisto.info("# Log memory status after the Slack request")
os.kill(os.getpid(), signal.SIGUSR1)
if response:
thread = response.get('ts')
if entitlement:
Expand Down Expand Up @@ -3057,5 +3068,5 @@ def main() -> None:
''' ENTRY POINT '''

if __name__ in ('__main__', '__builtin__', 'builtins'):
register_signal_handler_profiling_dump(profiling_dump_rows_limit=PROFILING_DUMP_ROWS_LIMIT)
register_signal_handler_profiling_dump()
main()
Loading