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

ActivityStream is swamped by tiles during resource creation #9768

Closed
azaroth42 opened this issue Jul 12, 2023 · 8 comments · Fixed by #10662
Closed

ActivityStream is swamped by tiles during resource creation #9768

azaroth42 opened this issue Jul 12, 2023 · 8 comments · Fixed by #10662
Assignees

Comments

@azaroth42
Copy link
Collaborator

When creating a resource, every tile that gets created during the process spawns an entry in the activity stream at /history. With only 19 instances, my stream is already at 1200 entries, making it very expensive to consume.

Instead, there should be a Create entry that subsumes all of the subsequent tile edit Update entries.

@chiatt chiatt added this to pipeline Jul 12, 2023
@azaroth42
Copy link
Collaborator Author

Propose that resource.save() should send a flag to the tile.save() function to prevent the creation of the edit_log entry for each tile. Tile edits don't go through resource.save(), so the updates still end up in the history.

Any downsides to this?

@apeters
Copy link
Member

apeters commented Jul 19, 2023

Maybe the activity stream could filter out the tile create entries?

@azaroth42
Copy link
Collaborator Author

Hi @apeters!

I tried that initially, but it's hard to determine which tile edits are part of the creation, and which are legitimate changes. Even after fixing #9769, you can't just remove all tile changes that immediately follow the resource's Create event, as there could be real edits to the resource with no intervening changes to other resources. And if the change post-create was to create a new tile (rather than to update the data in an existing one) it couldn't rely on the distinction between create and update. Perhaps it could trigger off of transactionid though, and only have one entry in the stream per transaction? The calculation of the pages in the stream becomes a challenge unless the filtering happens at the django / postgres level rather than the AS code.

Is there a reason for the tile creates in the log though? Is there any harm in filtering them out? Perhaps with a flag in settings to enable it?

@chiatt
Copy link
Member

chiatt commented Jul 19, 2023

Those entries are used for transaction reversals in workflows and bulk loader modules:

elif edit_log.edittype == "tile create":

Currently the bulk loader only creates tiles following the creation of resource, but we are working on allowing tiles to be appended to existing resources. We could add a setting to skip the creation of some edit records, but it would be important to hide any features that use transaction reversal whenever that flag is set to 'true'.

@azaroth42
Copy link
Collaborator Author

Got it, thanks Cyrus! For our current usage, I don't need bulk loading or backing out transactions so I don't think we're blocked in our current hacky workaround, but it would be good to discuss the right solution that allows both to co-exist. Per Alexei's response, having a filter that could distinguish internal tile creation within the resource creation would be great...

totalItems = models.EditLog.objects.all().exclude(resourceclassid=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID).count()

But I don't know how to do that :)

@apeters
Copy link
Member

apeters commented Jul 20, 2023

@azaroth42 Just to be clear it sounds like it's not simply tile create events that are the issue (because those could easily be filtered with edittype != "tile create"). What it sounds like you want to exclude is tiles created as part of resource creation, correct? Subsequent tile creation is essentially treated as an update to the resource and is a desired entry in the ActivityStream. Is that right?

@azaroth42
Copy link
Collaborator Author

Right!

If this line passed /something/ that could then be filtered on when constructing the list:

https://github.com/archesproject/arches/blob/master/arches/app/models/resource.py#L228

but rolled together for the transaction / bulk edit usage.

"import tile create" or somesuch?

@chiatt
Copy link
Member

chiatt commented Jul 20, 2023

The 'note' column is unused. We could document the context of the tile creation there.

@chiatt chiatt moved this to 📋 Backlog in pipeline Jul 26, 2023
@njkim njkim self-assigned this Mar 4, 2024
@njkim njkim moved this from 📋 Backlog to 🏗 In Progress in pipeline Mar 6, 2024
@jacobtylerwalls jacobtylerwalls moved this from 🏗 In Progress to 👀 In Review in pipeline Mar 25, 2024
@jacobtylerwalls jacobtylerwalls linked a pull request Mar 25, 2024 that will close this issue
6 tasks
jacobtylerwalls added a commit that referenced this issue Mar 26, 2024
jacobtylerwalls added a commit that referenced this issue Mar 26, 2024
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Done in pipeline Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants