The Background Worker needs a transaction to use Spi through BackgroundWorker::transaction(). For now I couldn't find a way to access the result from the Spi from outside the transaction without wrapping the variable using AssertUnwindSafe. As seen here:
https://github.com/laurenceisla/pgx_demo/blob/738e69a334ff202d024c07938dcde4b5afab7bfd/src/web_server_async.rs#L70-L74