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

Optimise the hasChanged logic, UpdateProperty, and refine the new records detection in DiffService. #330

Open
qifeng-bai opened this issue Nov 26, 2024 · 0 comments
Assignees

Comments

@qifeng-bai
Copy link
Contributor

In most cases, updateProperty is called first to update values such as counts or the ID of the latest records. For doing this, the findNewRecords method or similar logic in DiffService is called . However, the “findNewRecords or similar logic” is in different methods with similar functionality (TBC).

Subsequently, the hasChanged method uses the properties updated by updateProperty to determine if there are any changes.

When an alert is triggered, the hasChanged method is called again, and if it evaluates to true, findNewRecords in DiffService is invoked once more.

This approach results in findNewRecords (or its equivalents) being called multiple times. The sequence of these steps is inefficient, redundant, and unsafe, increasing complexity in building test cases.

Proposed Solution:

findNewRecords should be called first. The reasoning is simple: if there are new records, hasChanged should return true. Afterward, if necessary, UpdateProperty can be executed at the end of findNewRecords.

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

1 participant