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

Skip processing already processed files #46

Merged
merged 9 commits into from
Sep 11, 2023
Merged

Skip processing already processed files #46

merged 9 commits into from
Sep 11, 2023

Conversation

kaspth
Copy link
Owner

@kaspth kaspth commented Sep 11, 2023

This is the hackiest code I've done yet, but I just couldn't do it cleanly for now.

On first run for a file like this:

# tests/seeds/accounts/business.rb
accounts.create :business, name: "Big Business Co."

We both add data in the database and define a accounts.business accessor method, but once we've done that, we don't necessarily need to do it again.

So now we record the methods we add into tmp/oaken-result.yml, and via the file checksum we can see whether we've already processed the file. If we've already processed the file, we can "replay" those previously added methods and add them again.

This way we can skip the entire file because the checksum lets us know we've already handled it.

This is kind of at the edge of my ability to do, so I'm planning on sleeping on this and then keep tweaking the design. I'm also sure there's tons of pitfalls with this, it's not easy!

We record whenever we add a method and save that in a result YML file,
if we've already processed that file we replay those methods to recreate
them.

On replay the methods are still attributed to the same source location,
and they find the right records.
@kaspth kaspth merged commit cefd29f into main Sep 11, 2023
2 checks passed
@kaspth kaspth deleted the cache-by-path branch September 11, 2023 16:39
@kaspth kaspth mentioned this pull request Sep 12, 2023
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.

None yet

1 participant