Move RelationCounterField InstanceState field ops into RelationTracker.

Review Request #9758 — Created March 7, 2018 and submitted

Information

Djblets
release-1.0.x
0038b36...

Reviewers

InstanceState had a number of methods for setting counter field data
in the database, which was then being called by RelationTracker. By
having these split up, each call in RelationTracker had to be
accompanied by additional calls for synchronizing the values to other
model instances in other states, complicating those calls. It also meant
that InstanceState had to own a handful of functions that didn't
really need to be there.

This change moves those out into RelationTracker, and in the process
simplifies each of their implementations by using a contextmanager that
takes care of splitting up the states into "main" and "other" states
(removing the need for _separate_saved_states()) and then handling the
synchronizing (simplifying all call sites).

This is the second in a series of changes for simplifying the
implementation of RelationCounterField and making it less prone to
deadlocking issues.

All unit tests pass.

david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (b7b9edf)
Loading...