]> git.cworth.org Git - turbot/commit
Defer all sheet creation until after the channel is created
authorCarl Worth <cworth@cworth.org>
Thu, 22 Oct 2020 07:50:09 +0000 (00:50 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 22 Oct 2020 10:30:20 +0000 (03:30 -0700)
commitb9fc94a0e63e3eea4e06b869d7c771357714178c
treea8838f4fd2d33ac97c6b903e4db3505ed593b46b
parent9b570c69c799bc2442d712507474c803f7a571bf
Defer all sheet creation until after the channel is created

Specifically, we no longer attempt to do sheet creation in the handler
for the interaction of the user submitting a modal dialog. The reason
that was a a bad idea is that the sheet creation can take several
seconds, (including time to copy data from a template sheet, etc.),
while Slack will timeout after merely 3 seconds of a user submission
and report an error.

This way, we can promptly validate the user's input (giving them a
clean error on the form if necessary), then simply create the channel
in the handler and primomptly return (so Slack doesn't timeout).

Then, separately, we now have a listener setup for the channel_created
event and in _that_ handler we do all the sheet creation necessary. We
have all the time we want here since channel_created is just an event
without a user waiting for a response, so Slack doesn't impose a
3-second timeout on us.
turbot/events.py
turbot/interaction.py
turbot_lambda/turbot_lambda.py