finalTask.ts 838 B

1234567891011121314151617181920212223242526272829
  1. import { DBClient } from '../singletons'
  2. import { Status } from '../models/Status'
  3. import { forEachAsync } from '../utils'
  4. import { InitiaClient } from '../InitiaClient'
  5. async function startCheck(concurrency) {
  6. const accountsRaw = await DBClient.instance.randomTask.findMany({
  7. where: {
  8. finish: 1,
  9. },
  10. take: 2000,
  11. })
  12. await forEachAsync(accountsRaw, concurrency, async (account, index) => {
  13. console.log(`${index}/${accountsRaw.length}: processing ${account.address}`)
  14. console.log(account.id)
  15. try {
  16. // await faucetAccount(account.address)
  17. const notDone = []
  18. } catch (e) {
  19. console.log(e)
  20. // await DBClient.instance.account.update({
  21. // where: { id: account.id },
  22. // data: { status: Status.MayQueued, message: e.message },
  23. // })
  24. }
  25. })
  26. }
  27. startCheck(20)