Page MenuHomePhabricator

Allow LiskDAO to be forced to use a specific connection
ClosedPublic

Authored by epriestley on Mar 17 2015, 7:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 17, 12:21 PM
Unknown Object (File)
Fri, Dec 13, 8:42 PM
Unknown Object (File)
Fri, Dec 13, 10:10 AM
Unknown Object (File)
Fri, Dec 13, 10:10 AM
Unknown Object (File)
Fri, Dec 6, 6:15 AM
Unknown Object (File)
Thu, Dec 5, 10:41 PM
Unknown Object (File)
Wed, Nov 27, 3:26 PM
Unknown Object (File)
Nov 19 2024, 11:16 PM
Subscribers

Details

Summary

Ref T7522. This seems like the least-bad approach to a messy issue:

  • When backfilling accounts from an imported instance, I need to write ExternalAccount rows to the instance to link instance accounts with upstream accounts.
  • We do this in the daemons in some other cases, which lets us run all the code in the context of the instance. However, I really want to do this in-process here because it's way way simpler and we need to do writes to both the instance and the upstream, and they're interleaved, and they depend on one another.
  • I can hard-code the query with qsprintf() but that feels like 100x worse than this.

This allows me to do this:

id(new PhabricatorExternalAccount())
  ->setForcedConnnection($instance_conn)
  ->...
  ->save();

...and get a write to the instance database, which is at least not completely a minefield.

Test Plan

Backfilled instance accounts and got interleaved instance and upstream writes as expected.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Allow LiskDAO to be forced to use a specific connection.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.

I agree on the approach, in particular that versus a qsprintf this is MUCH better.

src/infrastructure/storage/lisk/LiskDAO.php
983–985

this can maybe move up a bit since the previous conditional has no effect afaik

This revision is now accepted and ready to land.Mar 17 2015, 8:09 PM
src/infrastructure/storage/lisk/LiskDAO.php
983–985

Ah, that's a good point. This should probably be stronger than the unit test stuff.

epriestley edited edge metadata.
  • Make forced connections stronger.
This revision was automatically updated to reflect the committed changes.