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

Hopefully final fix to infinite loop bug #305

Merged
merged 3 commits into from
Aug 10, 2023
Merged

Hopefully final fix to infinite loop bug #305

merged 3 commits into from
Aug 10, 2023

Conversation

vcarl
Copy link
Member

@vcarl vcarl commented Aug 10, 2023

This should fix the issue we've been seeing with crashes on invalid messages. Specifically the issue was because the array that was being shifted was not the same one being iterated on, thus the infinite loop.

Now the shift is a) done on the correct array, b) performed immediately after getting a reference to the underlying message, which should resolve the infinite loops we've been experiencing

We'll see if this also fixes the incorrect behavior I've seen where old forhire posts aren't reliably cleared out.

This should fix the issue we've been seeing with crashes on invalid messages. Specifically the issue was because the array that was being `shift`ed was not the same one being iterated on, thus the infinite loop.

Now the shift is a) done on the correct array, b) performed immediately after getting a reference to the underlying message, which should resolve the infinite loops we've been experiencing
@ghost
Copy link

ghost commented Aug 10, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@what-the-diff
Copy link

what-the-diff bot commented Aug 10, 2023

PR Summary

  • Introduced a helper function
    The partition function from another helper file has been brought into job-mod-helpers.ts. This may help with array handling in this file.

  • Created a new variable for job messages
    A new object named jobBoardMessageCache has been introduced, which is used for storing job related messages. It contains two properties, namely forHire and hiring which are initialized as empty arrays.

  • Improved message handling in loadJobs function
    The logic for filtering and adding new messages to jobBoardMessageCache was remodeled, which will likely improve how job messages are managed.

  • Removed unnecessary logging
    The logger import was cut off from the top in job-mod-helpers.ts. This simplifies the code and reduces unnecessary dependencies.

  • Revamped the deleteAgedPosts function
    The logic for creating forHirePosts and shifting methods for jobBoardMessageCache were restructured. Also, an unnecessary break statement after logging was removed, enhancing efficiency and readability for managing aged job posts.

  • Transformed the updateJobs function
    Changes were made in how the type is used and where messages are added in jobBoardMessageCache, enhancing ease and accuracy of tracking job updates.

  • Added a new function and updated an import in validate.ts
    A getLastPostAge function, which could be used to determine the age of the latest post, was introduced. A corresponding import was updated in this file.

  • Modified age tracking in participation function
    The way lastSent data is determined was changed, potentially improving how we track post participation over time.

@vcarl vcarl merged commit 7569d6d into main Aug 10, 2023
3 checks passed
@vcarl vcarl deleted the vc-job-board-fixes branch August 10, 2023 20:10
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.

1 participant