Skip to content

Add double submit protection in channel creation #3833

@sentry

Description

@sentry

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions