Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TaskData Typescript type #1519

Merged
merged 9 commits into from
Jul 7, 2020
Merged

Conversation

witem
Copy link
Contributor

@witem witem commented Jul 7, 2020

TaskData defined as object with params:

export interface TaskData {
params: {
[key: string]: any;
};
}

But when some task enqueues it not adds params cover, simply send inputs as arg:

export async function enqueue(
taskName: string,
inputs: { [key: string]: any },
queue: string = api.tasks.tasks[taskName].queue
) {
await validateInput(taskName, inputs);
return api.resque.queue.enqueue(queue, taskName, [inputs]);

witem and others added 6 commits February 25, 2019 16:33
…tions

Signed-off-by: a.kuzmenko <witem.artem@gmail.com>
…nhero

Signed-off-by: a.kuzmenko <1782530+witem@users.noreply.github.com>
…nhero

Signed-off-by: a.kuzmenko <1782530+witem@users.noreply.github.com>
…nhero

Signed-off-by: a.kuzmenko <1782530+witem@users.noreply.github.com>
Signed-off-by: a.kuzmenko <1782530+witem@users.noreply.github.com>
@evantahler
Copy link
Member

Thank you!

How would you feel about also using the TaskData type in modules/task (replacing { [key: string]: any }) to indicate that the same data will be returned back to the task when run?

ie:

inputs: { [key: string]: any },

inputs: { [key: string]: any },

inputs: { [key: string]: any },

args?: { [key: string]: any },

inputs?: { [key: string]: any }

inputs: { [key: string]: any }

Signed-off-by: a.kuzmenko <1782530+witem@users.noreply.github.com>
@witem
Copy link
Contributor Author

witem commented Jul 7, 2020

@evantahler I think its good idea. I change it.
But maybe also need change argument name from inputs to taskDatanot to be confused with inputs in task describe

@evantahler
Copy link
Member

That works for me! Feel free to change the name if you want!

Signed-off-by: a.kuzmenko <1782530+witem@users.noreply.github.com>
@witem
Copy link
Contributor Author

witem commented Jul 7, 2020

I change arguments naming, check please. Thanks!

@evantahler
Copy link
Member

Ah! I should have been more clear, I'm sorry - Since we use the word inputs already in our examples and docs, I think we should keep that word. I would suggest changing TaskData to TaskInputs in the exported interface.

Signed-off-by: a.kuzmenko <1782530+witem@users.noreply.github.com>
@witem
Copy link
Contributor Author

witem commented Jul 7, 2020

Ok, I update

@evantahler
Copy link
Member

Awesome! Thanks!

@evantahler evantahler merged commit 144a417 into actionhero:master Jul 7, 2020
@witem witem deleted the fix-task-data-type branch July 7, 2020 17:10
@evantahler evantahler changed the title Fix TaskData type Fix TaskData Typescript type Jul 16, 2020
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.

None yet

2 participants