Well I'm happy to report I finally got it working as advertised.
I put this:
before the async code. that way when it checks the DB, if the DB is empty, it won't try to run any of the async or dbi code where it gets into trouble. I shouldn't really have to do that, but as it turns out, that's how I got it to behave. The whole thing was UGLY, but it worked.
-S