Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
hestiaHUGO: second attempts to counter "memory leak" symptom
Browse files Browse the repository at this point in the history
Since the first attempt did not remove that symptom, we have to
apply the 2nd attempt: total removal of using persistent memory
algorithms. Affected functions would be .Contributors and PWA URL
automatic caching capability. Hence let's do this.

Co-authored-by: Shuralyov, Jean <[email protected]>
Co-authored-by: Galyna, Cory <[email protected]>
Co-authored-by: (Holloway) Chew, Kean Ho <[email protected]>
Signed-off-by: (Holloway) Chew, Kean Ho <[email protected]>
  • Loading branch information
3 people committed Jun 1, 2023
1 parent 5e630c8 commit 0ac8d8a
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 374 deletions.
12 changes: 0 additions & 12 deletions hestiaHUGO/data/Hestia/PWA/Caches.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@



# Automation - automatic URL Inclusion
#
# Enabled (true/false) - To enable automatic URL caching. Only URLs being
# processed by Hestia URL API that has the .URL.Base
# prefix are cached regardless of its actual use in
# any of the display contents.
[Automation]
Enabled = true




# Policy - Default Caching policy. They can only be the following values:
# 'cache-first' - Default. Resource shall use the cache version
# first and then perform a network update on it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ specific language governing permissions and limitations under the License.
{{- /* clean up unwanted fields */ -}}
{{- $dataList = merge $dataList (dict
"Content" false
"Contributors" (dict "Site" false)
"Memory" false
"Data" (dict "Store" false)
) -}}
{{- $dataList = merge $dataList (dict
"Content" dict
"Contributors" (dict "Site" dict)
"Memory" dict
"Data" (dict "Store" dict)
) -}}
{{- $dataList = partial "hestiaCOMPILERS/hestiaHUGO/Clean" $dataList -}}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@ specific language governing permissions and limitations under the License.
"Time" (dict "Format" "Mon 02 Jan 2006 15:04:05 PM -07")
"Offline" (dict "MemKey" "Caches")
"Contributors" (dict
"RolesMemKey" "Contributors"
"Roles" (partial "hestiaENTITY/Roles")
)
) -}}




{{- /* initiate memory store */ -}}
{{- $dataList = merge $dataList (dict "Memory" .Store) -}}
{{- /* process .Data.Store */ -}}
{{- $dataList = merge $dataList (dict "Data" (dict "Store" .Site.Data)) -}}



Expand Down Expand Up @@ -228,16 +227,10 @@ specific language governing permissions and limitations under the License.


{{- /* initiate page's .Contributors */ -}}
{{- if or .IsHome (not (partial "hestiaCOMPILERS/hestiaHUGO/loadContributors" $dataList)) -}}
{{- $ret = dict
"Site" (partial "hestiaCOMPILERS/hestiaHUGO/_parseContributors" .)
"Page" dict
-}}
{{- else -}}
{{- /* upstream has a cached copy. avoid parsing */ -}}
{{- $ret = dict "Site" dict "Page" dict -}}
{{- end -}}
{{- $dataList = merge $dataList (dict "Contributors" $ret) -}}
{{- $dataList = merge $dataList (dict "Contributors" (dict
"Site" .Site.Data.Hestia.Contributors
"Page" dict
)) -}}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ specific language governing permissions and limitations under the License.



{{- /* process .Data.Store */ -}}
{{- $dataList = merge $dataList (dict "Data" (dict "Store" .Site.Data)) -}}




{{- /* process .Data.Store */ -}}
{{- $dataList = merge $dataList (dict "Content" dict) -}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,35 +536,9 @@ specific language governing permissions and limitations under the License.


{{- /* process .Contributors.Site */ -}}
{{- $dataList = partial "hestiaCOMPILERS/hestiaHUGO/loadContributors" $Page -}}
{{- if or .IsRoot (not $dataList) -}}
{{- $dataList = dict -}}
{{- range $k, $v := $Page.Contributors.Site -}}
{{- $ret = merge $Page (dict "Input" (dict "Data" $v)) -}}
{{- $ret = partial "hestiaENTITY/Sanitize" $ret -}}
{{- if $ret.Error -}}
{{- $error = printf ".Contributors.%v: %v" $k $ret.Error -}}
{{- $error = merge $Page (dict "Error" $error) -}}
{{- partial "hestiaIO/hestiaTERM/Errorf" $error -}}
{{- continue -}}
{{- end -}}
{{- $dataList = merge $dataList (dict $k $ret.Output) -}}
{{- end -}}

{{- $dataList = merge $Page (dict "Input" (dict "Data" $dataList)) -}}
{{- partial "hestiaCOMPILERS/hestiaHUGO/saveContributors" $dataList -}}
{{- $dataList = partial "hestiaCOMPILERS/hestiaHUGO/loadContributors" $Page -}}
{{- end -}}
{{- $Page = merge $Page (dict "Contributors" false) -}}
{{- $Page = merge $Page (dict "Contributors" (dict "Site" $dataList)) -}}




{{- /* process .Contributors.Page */ -}}
{{- $dataList = dict -}}
{{- range $k, $v := .Contributors.Page -}}
{{- $data = index $Page.Contributors.Site $k -}}
{{- $data = index $Page.Data.Store.Hestia.Contributors $k -}}
{{- if not $data -}}
{{- $error = printf ".Contributors.Page: unknown entity '%v'.\n" $k -}}
{{- $error = merge $Page (dict "Error" $error) -}}
Expand All @@ -573,6 +547,17 @@ specific language governing permissions and limitations under the License.
{{- end -}}


{{- $data = merge $Page (dict "Input" (dict "Data" $data)) -}}
{{- $data = partial "hestiaENTITY/Sanitize" $data -}}
{{- if $data.Error -}}
{{- $error = printf ".Contributors.%v: %v" $k $data.Error -}}
{{- $error = merge $Page (dict "Error" $error) -}}
{{- partial "hestiaIO/hestiaTERM/Errorf" $error -}}
{{- continue -}}
{{- end -}}
{{- $data = $data.Output -}}


{{- if not (index $v "Contribution") -}}
{{- continue -}}
{{- end -}}
Expand Down Expand Up @@ -607,8 +592,8 @@ specific language governing permissions and limitations under the License.

{{- $dataList = merge $dataList (dict $k $data) -}}
{{- end -}}
{{- $Page = merge $Page (dict "Contributors" (dict "Page" false)) -}}
{{- $Page = merge $Page (dict "Contributors" (dict "Page" $dataList)) -}}
{{- $Page = merge $Page (dict "Contributors" false) -}}
{{- $Page = merge $Page (dict "Contributors" $dataList) -}}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,18 +642,8 @@ specific language governing permissions and limitations under the License.

{{- $data = merge $data (dict $ret $ret2) -}}
{{- end -}}

{{- $ret = merge $Page (dict "Input" (dict "Data" $data)) -}}
{{- $ret = partial "hestiaCOMPILERS/hestiaHUGO/SaveOfflineURL" $ret -}}
{{- if $ret.Error -}}
{{- $error = printf ".PWA.Caches: %v" $ret.Error -}}
{{- $error = merge $Page (dict "Error" $error) -}}
{{- partial "hestiaIO/hestiaTERM/Errorf" $error -}}
{{- end -}}
{{- $Page = merge $Page (dict "PWA" (dict "Caches" (dict "List" false))) -}}
{{- $Page = merge $Page (dict "PWA" (dict "Caches" (dict "List"
(partial "hestiaCOMPILERS/hestiaHUGO/loadOfflineURL" $Page)
))) -}}
{{- $Page = merge $Page (dict "PWA" (dict "Caches" (dict "List" $data))) -}}



Expand Down

This file was deleted.

Loading

0 comments on commit 0ac8d8a

Please sign in to comment.