How to use the @cumulus/ingest/lock.removeLock function in @cumulus/ingest

To help you get started, we’ve selected a few @cumulus/ingest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus / tasks / sync-granule / index.js View on Github external
const endTime = Date.now();

      return {
        ...r,
        sync_granule_duration: endTime - startTime
      };
    } catch (e) {
      log.error(e);
      throw e;
    }
  };

  try {
    return await pMap(granules, ingestGranule, { concurrency: 1 });
  } finally {
    await lock.removeLock(bucket, provider.id, granules[0].granuleId);
  }
}
github nasa / cumulus / cumulus / tasks / sync-granule / index.js View on Github external
throw err;
  }

  for (const g of granules) {
    try {
      const r = await ingest.ingest(g);
      updatedGranules.push(r);
    }
    catch (e) {
      await lock.removeLock(bucket, provider.id, g.granuleId);
      log.error(e);
      throw e;
    }
  }

  await lock.removeLock(bucket, provider.id, granules[0].granuleId);
  return updatedGranules;
}