Pull Request: https://github.com/edx/edx-platform/pull/7258
Description
DjangoKeyValueStore.set_many
was causing multiple writes whenever it saved data for a newly created XBlock. It called FieldDataCache.find_or_create
which, if the block wasn't cached, did a get_or_create
call to create it. Then DjangoKeyValueStore
immediately called save
on that block. This results in both an insert of empty state, and then an update of that record. This change means that FieldDataCache
no longer calls get_or_create
and instead just returns a new, in-memory django model object, which is then saved by DjangoKeyValueStore
.
Results