[ 
https://issues.apache.org/jira/browse/SLING-10968?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joerg Hoh updated SLING-10968:
------------------------------
    Description: 
Currently whenever a relevant change to the  is detected, the configuration is 
reloaded [0] and a respective event is sent [1]. This event does not contain 
the location of the actual change, but only the fact that such an event 
happened [2].
If multiple relevant changes happen this can mean that multiple events are 
sent. It is already prevented that multiple reloads happen within the same 
{{onChange}} call.

The only observable change would be that that instead of potential multiple 
events just a single event is fired (if at all). 


[0] 
https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L682
[1] 
https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L756
[2] 
https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L926

  was:
Currently whenever a relevant change to the  is detected, the configuration is 
reloaded [0] and a respective event is sent [1]. This event does not contain 
the location of the actual change, but only the fact that such an event 
happened [2].
If multiple relevant changes happen, this can mean that the config is reloaded 
multiple times and that multiple events are sent.

This can be optimized in a way, that if it has been determined, that a reload 
must happen, it is done once and a single event is sent. the remaining (not 
yet-processed) events can be ignored, because doing so would just be redundant.

The only observable change would be that that instead of potential multiple 
events just a single event is fired (if at all). 


[0] 
https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L682
[1] 
https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L756
[2] 
https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L926


> Reduce reload events on content changes
> ---------------------------------------
>
>                 Key: SLING-10968
>                 URL: https://issues.apache.org/jira/browse/SLING-10968
>             Project: Sling
>          Issue Type: Improvement
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.8.0
>            Reporter: Joerg Hoh
>            Priority: Major
>
> Currently whenever a relevant change to the  is detected, the configuration 
> is reloaded [0] and a respective event is sent [1]. This event does not 
> contain the location of the actual change, but only the fact that such an 
> event happened [2].
> If multiple relevant changes happen this can mean that multiple events are 
> sent. It is already prevented that multiple reloads happen within the same 
> {{onChange}} call.
> The only observable change would be that that instead of potential multiple 
> events just a single event is fired (if at all). 
> [0] 
> https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L682
> [1] 
> https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L756
> [2] 
> https://github.com/apache/sling-org-apache-sling-resourceresolver/blob/ea9a34577edf7eff53b5a8f8bd4f1417a72af5aa/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java#L926



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to