Skip to content

Commit

Permalink
fix: remove send to gendex queue (#2287)
Browse files Browse the repository at this point in the history
Infra in cloudflare cannot process this quick enough or cheaply enough.
  • Loading branch information
Alan Shaw authored Jul 3, 2023
1 parent 9d6183e commit a2cf9fd
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 48 deletions.
16 changes: 1 addition & 15 deletions packages/api/src/car.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { MAX_BLOCK_SIZE, CAR_CODE } from './constants.js'
import { JSONResponse } from './utils/json-response.js'
import { getPins, PIN_OK_STATUS, waitAndUpdateOkPins } from './utils/pin.js'
import { normalizeCid } from './utils/cid.js'
import { rawCarPathToShardCid } from './utils/bucket.js'

/**
* @typedef {import('multiformats/cid').CID} CID
Expand Down Expand Up @@ -166,10 +165,6 @@ export async function handleCarUpload (request, env, ctx, car, uploadType = 'Car
dagSize
})

if (structure === 'Complete' && env.GENDEX_QUEUE) {
await env.GENDEX_QUEUE.send({ shards: [carCid.toString()] })
}

/** @type {(() => Promise<any>)[]} */
const tasks = []

Expand All @@ -186,16 +181,7 @@ export async function handleCarUpload (request, env, ctx, car, uploadType = 'Car
}, { retries: 3 })

if (report.structure === 'Complete') {
return await Promise.all([
pRetry(() => env.db.upsertPins([elasticPin(report.structure)]), { retries: 3 }),
// trigger block indexes to be built for this DAG
pRetry(async () => {
if (env.GENDEX_QUEUE) {
const shards = report.cars.map(rawCarPathToShardCid).map(cid => cid.toString())
await env.GENDEX_QUEUE.send({ shards })
}
}, { retries: 3 })
])
return await pRetry(() => env.db.upsertPins([elasticPin(report.structure)]), { retries: 3 })
}
}

Expand Down
17 changes: 0 additions & 17 deletions packages/api/src/utils/bucket.js

This file was deleted.

16 changes: 0 additions & 16 deletions packages/api/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ new_classes = ["NameRoom0"]
tag = "v1"
deleted_classes = ["NameRoom0"]

[[queues.producers]]
queue = "gendex-dev"
binding = "GENDEX_QUEUE"

# ---- Environment specific overrides below ! ----
# NOTE: wrangler automatically assigns each env the root `name` with the env name suffixed on the end
# NOTE: wrangler tries to find an account_id defined at the root if workers_dev = true is not provided on your env.
Expand All @@ -39,10 +35,6 @@ r2_buckets = [
{ binding = "SATNAV", bucket_name = "satnav-test-0" }
]

[[env.test.queues.producers]]
queue = "gendex-test"
binding = "GENDEX_QUEUE"

# PROD!
[env.production]
# name = "web3-storage-production"
Expand All @@ -55,10 +47,6 @@ r2_buckets = [
{ binding = "SATNAV", bucket_name = "satnav-prod-0" }
]

[[env.production.queues.producers]]
queue = "gendex-production"
binding = "GENDEX_QUEUE"

[env.staging]
# name = "web3-storage-staging"
account_id = "fffa4b4363a7e5250af8357087263b3a" # Protocol Labs CF account
Expand All @@ -71,10 +59,6 @@ r2_buckets = [
{ binding = "SATNAV", bucket_name = "satnav-staging-0" }
]

[[env.staging.queues.producers]]
queue = "gendex-staging"
binding = "GENDEX_QUEUE"

[env.alan]
workers_dev = true
account_id = "4fe12d085474d33bdcfd8e9bed4d8f95"
Expand Down

0 comments on commit a2cf9fd

Please sign in to comment.