Comment 12 for bug 1879645

Revision history for this message
Ian Booth (wallyworld) wrote :

So I think I found the cause.

When the last unit leaves scope, the relation also is set to be deleted. If the relation deletion event is processed by the cross model workers before the unit change event arrives, the watcher for the unit change event is stopped and the unit event never gets processed (it looks like the event gets thrown away which is effectively what happens), and the offering model never gets told the last unit is gone, hence it retains the relation on its side.

I hacked together a quick POC fix by not stopping the unit change watcher when the relation dies and that fixed it. Need to do a proper fix.