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

Add double submit protection in channel creation #3833

Closed
sentry-io bot opened this issue Nov 22, 2022 · 3 comments
Closed

Add double submit protection in channel creation #3833

sentry-io bot opened this issue Nov 22, 2022 · 3 comments
Assignees

Comments

@sentry-io
Copy link

sentry-io bot commented Nov 22, 2022

Observed behavior

When creating a new channel, if the request to create the channel takes a significant amount of time, the user may click the submit button more than once.

Sentry Issue: STUDIO-FKE
Sentry frontend issue: STUDIO-FHC

UniqueViolation: duplicate key value violates unique constraint "contentcuration_channel_pkey"
DETAIL:  Key (id)=(db678fc39db448328cb967ee6f97ffd0) already exists.

  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "newrelic/hooks/database_psycopg2.py", line 64, in execute
    return super(CursorWrapper, self).execute(sql, parameters, *args,
  File "newrelic/hooks/database_dbapi2.py", line 38, in execute
    return self.__wrapped__.execute(sql, parameters,
  File "django_prometheus/db/common.py", line 71, in execute
    return super().execute(*args, **kwargs)

IntegrityError: duplicate key value violates unique constraint "contentcuration_channel_pkey"
DETAIL:  Key (id)=(db678fc39db448328cb967ee6f97ffd0) already exists.

(29 additional frame(s) were not displayed)
...
  File "django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "newrelic/hooks/database_psycopg2.py", line 64, in execute
    return super(CursorWrapper, self).execute(sql, parameters, *args,
  File "newrelic/hooks/database_dbapi2.py", line 38, in execute
    return self.__wrapped__.execute(sql, parameters,
  File "django_prometheus/db/common.py", line 71, in execute
    return super().execute(*args, **kwargs)
@sentry-io
Copy link
Author

sentry-io bot commented Nov 22, 2022

Sentry issue: STUDIO-FHC

@rtibbles
Copy link
Member

I think the first step here will be disabling the Channel save button while the save is happening. We can then look more into giving a better error from the API endpoint if the double save does try to happen.

@bjester
Copy link
Member

bjester commented Dec 5, 2022

Addressed by #3843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants