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

Unnecessary data in a Job class #69

Closed
Manriel opened this issue Jan 29, 2025 · 3 comments
Closed

Unnecessary data in a Job class #69

Manriel opened this issue Jan 29, 2025 · 3 comments

Comments

@Manriel
Copy link
Contributor

Manriel commented Jan 29, 2025

Probably, we don't need to push the LogToDb main class into the Job here

public function __construct(protected object $logToDb, protected LogRecord $record)

Passing the class instance into the Job is causing to have an additional data of that class in json-serialized representation of the job in redis/db/whatever job storage it use.

At the same time we always could get a LogToDb class instance right inside the job's handle method without performance cost.

So, right now in a waiting jobs we just waste RAM to store copies of identical data which recoverable without job-specific context.

@danielme85
Copy link
Owner

I see what your saying, agreed. Probably don't need to serialize the whole object. I prob just followed the Laravel doc back in the day :p

Feel free to suggest a PR, or I'll look at it when I have some time.

@Manriel
Copy link
Contributor Author

Manriel commented Feb 26, 2025

#70 should fix this

@danielme85
Copy link
Owner

merged into main, thanks!

@Manriel Manriel closed this as completed Mar 5, 2025
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

No branches or pull requests

2 participants