Skip to content

fix(job): make ctx and env binding to Job instances to use in handle()#57

Open
mileszim wants to merge 1 commit intojplhomer:mainfrom
mileszim:job-binding
Open

fix(job): make ctx and env binding to Job instances to use in handle()#57
mileszim wants to merge 1 commit intojplhomer:mainfrom
mileszim:job-binding

Conversation

@mileszim
Copy link

@mileszim mileszim commented Oct 1, 2023

This makes the env and ctx params available to Job instances. Resolves #56

async function handleQueueMessage(message: Message, ctx: ExecutionContext) {
async function handleQueueMessage<Env>(message: Message, ctx: ExecutionContext, env: Env) {
const instance = await hydrateInstanceFromQueuePayload(
message.body as MessagePayload
Copy link
Owner

Choose a reason for hiding this comment

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

I think it would make more sense to pass ctx and env here as second or third args, since that function is responsible for hydrating an instance. (even if we only end up assigning it for Job instances). Thoughts?

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.

Accessing ENV in Job

2 participants