Skip to content

Add llmstxt generator endpoint#1201

Merged
nickscamara merged 26 commits intomainfrom
ec/llms-txt-generator
Feb 19, 2025
Merged

Add llmstxt generator endpoint#1201
nickscamara merged 26 commits intomainfrom
ec/llms-txt-generator

Conversation

@ericciarla
Copy link
Contributor

No description provided.

Copy link
Member

@mogery mogery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some weirdness going on, but overall looks good

Comment on lines -505 to -607
const job = await worker.getNextJob(token);
if (job) {
if (job.id) {
runningJobs.add(job.id);
}

async function afterJobDone(job: Job<any, any, string>) {
try {
const job = await worker.getNextJob(token);
if (job) {
if (job.id) {
runningJobs.delete(job.id);
}

if (job.id && job.data && job.data.team_id && job.data.plan) {
await removeConcurrencyLimitActiveJob(job.data.team_id, job.id);
cleanOldConcurrencyLimitEntries(job.data.team_id);

// Queue up next job, if it exists
// No need to check if we're under the limit here -- if the current job is finished,
// we are 1 under the limit, assuming the job insertion logic never over-inserts. - MG
const nextJob = await takeConcurrencyLimitedJob(job.data.team_id);
if (nextJob !== null) {
await pushConcurrencyLimitActiveJob(job.data.team_id, nextJob.id, calculateJobTimeToRun(nextJob));

await queue.add(
nextJob.id,
{
...nextJob.data,
concurrencyLimitHit: true,
},
{
...nextJob.opts,
jobId: nextJob.id,
priority: nextJob.priority,
},
);
}
runningJobs.add(job.id);
}
}

if (job.data && job.data.sentry && Sentry.isInitialized()) {
Sentry.continueTrace(
{
sentryTrace: job.data.sentry.trace,
baggage: job.data.sentry.baggage,
},
() => {
Sentry.startSpan(
{
name: "Scrape job",
attributes: {
job: job.id,
worker: process.env.FLY_MACHINE_ID ?? worker.id,
},
},
async (span) => {
await Sentry.startSpan(
{
name: "Process scrape job",
op: "queue.process",
attributes: {
"messaging.message.id": job.id,
"messaging.destination.name": getScrapeQueue().name,
"messaging.message.body.size": job.data.sentry.size,
"messaging.message.receive.latency":
Date.now() - (job.processedOn ?? job.timestamp),
"messaging.message.retry.count": job.attemptsMade,
},
},
async () => {
let res;
try {
res = await processJobInternal(token, job);
} finally {
await afterJobDone(job);
}

if (res !== null) {
span.setStatus({ code: 2 }); // ERROR
} else {
span.setStatus({ code: 1 }); // OK
}
},
);
},
);
},
);
} else {
Sentry.startSpan(
{
name: "Scrape job",
name: "Process job",
attributes: {
job: job.id,
worker: process.env.FLY_MACHINE_ID ?? worker.id,
worker: process.env.FLY_MACHINE_ID ?? queue.name,
},
},
() => {
processJobInternal(token, job).finally(() => afterJobDone(job));
processJobFn(token, job).finally(() => {
if (job.id) {
runningJobs.delete(job.id);
}
});
},
);
}

await sleep(gotJobInterval);
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wot??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@nickscamara nickscamara merged commit d984b50 into main Feb 19, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants