[SE-4101] address VisibleBlocks caching race condition

Description

This PR is trying to address a hard-to-reproduce VisibleBlocks per-user caching issue in which case bulk create results an IntegrityError, though it shouldn't

*Discussions*: [Forum post](https://discuss.openedx.org/t/need-information-about-persistent-grades/1412/7?u=gabor)

*Dependencies*: None

*Sandbox URL*: N/A - We were not able to produce a sandbox which can "consistently" show the issue.

*Merge deadline*: None

*Testing instructions*:

1. Read through the code

*Author notes and concerns*:

This fix is deployed for one of our clients and it is working well. We did no see issues since we applied the patch.

1. The issue is really hard to reproduce as it is based on a possible race condition

*Reviewers*

  • [ ] @pkulkark

Won't Do
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Unassigned

Reporter

Open Source Pull Request Bot

Labels

Contributor Name

Gábor Boros

Repo

edx/edx-platform

Customer

Github Lines Added

28

Github Lines Deleted

5