Skip to content

Commit

Permalink
Fixed hub return types
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaree committed Oct 27, 2020
1 parent 3e6051b commit 2347a8e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ hub.post("/", async (req, res) => {
// Fetch the last block number this given config file queried the blockchain at if running in production. Else, pull from env.
const lastQueriedBlockNumber = await _getLastQueriedBlockNumber(req.body.configFile);
if (!configObject || !lastQueriedBlockNumber)
throw new Error("Serverless hub requires a config object and a last updated block number!");
throw new Error(
`Serverless hub requires a config object and a last updated block number! configObject:${configObject} lastQueriedBlockNumber: ${lastQueriedBlockNumber}`
);

// Get the latest block number. The query will run from the last queried block number to the latest block number.
const latestBlockNumber = await _getLatestBlockNumber();
Expand Down Expand Up @@ -261,7 +263,7 @@ async function _saveQueriedBlockNumber(configIdentifier, blockNumber) {
// recorded by the bot to inform where searches should start from.
async function _getLastQueriedBlockNumber(configIdentifier) {
// sometimes the GCP datastore can be flaky and return errors when saving data. Use re-try logic to re-run on error.
await retry(
return await retry(
async () => {
if (hubConfig.saveQueriedBlock == "gcp") {
const key = datastore.key(["BlockNumberLog", configIdentifier]);
Expand Down Expand Up @@ -360,4 +362,4 @@ if (require.main === module) {
}

hub.Poll = Poll;
module.exports = hub;
module.exports = { hub, _getLastQueriedBlockNumber };

0 comments on commit 2347a8e

Please sign in to comment.