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

Open some events for external subscription #547

Open
hyzx86 opened this issue May 4, 2024 · 4 comments · May be fixed by #582
Open

Open some events for external subscription #547

hyzx86 opened this issue May 4, 2024 · 4 comments · May be fixed by #582

Comments

@hyzx86
Copy link
Contributor

hyzx86 commented May 4, 2024

Currently we have some events open in OC, but those are not enough, some events may be an intermediate process,

for example, we get an object and try UpdateAsync first, the object state is then saved to the state manager.
Then call some validation function ValidateAsync in OC
Then publish it

https://github.com/OrchardCMS/OrchardCore/blob/dcf83bca479ad06eeb41b9a09292a67fa26a2b21/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/CreateEndpoint.cs#L59-L120

We cannot tell if a Save is the last one to be committed to the database

So my suggestion is to expose some events externally through YesSql's series of IIndexCmmand types
Used to notify external programs that the object has been committed to the database,
You can perform subsequent operations

For example, update the Lucene index and create a custom index table (this is what I am working on 😅 )

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 4, 2024

Hi @Skrypt , There's a similar problem here, right? An index action may be performed multiple times on the same document when updating a piece of content.

https://github.com/OrchardCMS/OrchardCore/blob/dcf83bca479ad06eeb41b9a09292a67fa26a2b21/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Handler/LuceneIndexingContentHandler.cs#L29-L33

@Skrypt
Copy link
Contributor

Skrypt commented Jul 3, 2024

Good question. Normally it should not. I never saw this execute twice yet. Maybe something has changed. If we index multiple times then it is a strong performance issue.

@hyzx86
Copy link
Contributor Author

hyzx86 commented Jul 6, 2024

Yes, it's true that it hasn't been updated twice so far, because Yessql's SaveAsync just adds the object to the pending collection.

I've been looking at Yessql's code over and over again, and I think it's worth opening up some of the functionality to customisation.

If I want to add some custom actions before executing the Add, Delete, and Update commands to the database, what should I do?

@hyzx86
Copy link
Contributor Author

hyzx86 commented Jul 23, 2024

@Skrypt I created a branch , on my own repository, because our current project is mainly based on oc 1.8.3 It depends on yessql 4.0.
So I created this PR based on yessql 4.0
hyzx86#1

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 a pull request may close this issue.

2 participants