s-r-x / bull-monitor

🐂 Standard UI for Bull and BullMQ.
https://s-r-x.github.io/bull-monitor/
MIT License
123 stars 38 forks source link

feat: support object progress #51

Closed fritx closed 2 years ago

fritx commented 2 years ago

Fix #14, below is the source code of bullmq:

https://github.com/taskforcesh/bullmq/blob/cf0710cfe322eb2147f439364b425763b4d5c592/src/classes/job.ts#L246

image

https://github.com/taskforcesh/bullmq/blob/cf0710cfe322eb2147f439364b425763b4d5c592/src/classes/scripts.ts#L231

image

I'm not sure is it ok to just change 'progress' from Int to JSON, but it works for me in both cases:

image

fritx commented 2 years ago

And it is better to replace Record<string, any> with a JSONValue implementation?

https://github.com/microsoft/TypeScript/issues/1897 https://dev.to/ankittanna/how-to-create-a-type-for-complex-json-object-in-typescript-d81

type JSONValue =
    | string
    | number
    | boolean
    | { [x: string]: JSONValue }
    | Array<JSONValue>;
s-r-x commented 2 years ago

i don't understand how this is suppose to work, when there is no changes inside this getter

fritx commented 2 years ago

I'm using the bull-monitor cli, where bull-adapter is used.

I can only see bullmq-adapter is referenced in fixtures/bull-server/server.

s-r-x commented 2 years ago

take a look at the readme. bull (or bullmq) adapter is required in order to make bull-monitor work, since we support both bull and bullmq.

s-r-x commented 2 years ago

btw now i understand why you are getting that weird gql error - our cli works fine only with bull(not bullmq)

fritx commented 2 years ago

yes, I'm using the cli, can we support it? maybe some option is needed?

s-r-x commented 2 years ago

definitely possible, i guess we can add some flag like "bullmq" to the cli and wrap queues with the appropriate adapter