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

refactor(queue): remove unnecessary index field in scheduledJob #136

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

hongkuancn
Copy link
Contributor

@hongkuancn hongkuancn commented Sep 12, 2024

Hi!

I found the job queue is implemented according to example of container/heap - Go Packages. However, the index field is initialized in Item struct in the example (like the following code), while the scheduleJob struct doesn't do the same thing, so the index is always 0 in scheduleJob struct.

	for value, priority := range items {
		pq[i] = &Item{
			value:    value,
			priority: priority,
			index:    i,        //  <----  this line
		}
		i++
	}

Actually, I don't think the index is needed in scheduleJob. The index hasn't been used before because it hasn't been set up properly. So I just removed it.

Please let me know if there is anything I missed out.

@hongkuancn hongkuancn changed the title remove unnecessary index field in scheduleJob struct Remove unnecessary index field in scheduleJob struct Sep 12, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.62%. Comparing base (928d076) to head (2960968).
Report is 1 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #136      +/-   ##
==========================================
- Coverage   94.95%   94.62%   -0.34%     
==========================================
  Files          19       19              
  Lines         972      967       -5     
==========================================
- Hits          923      915       -8     
- Misses         32       34       +2     
- Partials       17       18       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@reugn reugn changed the title Remove unnecessary index field in scheduleJob struct refactor(queue): remove unnecessary index field in scheduledJob Sep 12, 2024
Copy link
Owner

@reugn reugn left a comment

Choose a reason for hiding this comment

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

You're right, @hongkuancn. In the example, the index field is required by the update method, and is redundant in the quartz implementation.

@reugn reugn merged commit be00d59 into reugn:master Sep 12, 2024
3 checks passed
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