Try debug cache sizing on Safari

This commit is contained in:
Lim Chee Aun 2024-11-08 12:58:28 +08:00
parent a1a4b01ace
commit efc3fe5de4
2 changed files with 29 additions and 24 deletions

36
src/locales/en.po generated
View file

@ -193,7 +193,7 @@ msgstr ""
#: src/pages/catchup.jsx:72 #: src/pages/catchup.jsx:72
#: src/pages/catchup.jsx:1447 #: src/pages/catchup.jsx:1447
#: src/pages/catchup.jsx:2068 #: src/pages/catchup.jsx:2068
#: src/pages/settings.jsx:1140 #: src/pages/settings.jsx:1145
msgid "Boosts" msgid "Boosts"
msgstr "" msgstr ""
@ -1270,7 +1270,7 @@ msgstr ""
#: src/pages/home.jsx:224 #: src/pages/home.jsx:224
#: src/pages/mentions.jsx:20 #: src/pages/mentions.jsx:20
#: src/pages/mentions.jsx:167 #: src/pages/mentions.jsx:167
#: src/pages/settings.jsx:1132 #: src/pages/settings.jsx:1137
#: src/pages/trending.jsx:381 #: src/pages/trending.jsx:381
msgid "Mentions" msgid "Mentions"
msgstr "" msgstr ""
@ -1325,7 +1325,7 @@ msgstr ""
#: src/pages/catchup.jsx:2062 #: src/pages/catchup.jsx:2062
#: src/pages/favourites.jsx:11 #: src/pages/favourites.jsx:11
#: src/pages/favourites.jsx:23 #: src/pages/favourites.jsx:23
#: src/pages/settings.jsx:1136 #: src/pages/settings.jsx:1141
msgid "Likes" msgid "Likes"
msgstr "" msgstr ""
@ -2317,7 +2317,7 @@ msgid "<0/> <1/> boosted"
msgstr "" msgstr ""
#: src/components/timeline.jsx:453 #: src/components/timeline.jsx:453
#: src/pages/settings.jsx:1160 #: src/pages/settings.jsx:1165
msgid "New posts" msgid "New posts"
msgstr "" msgstr ""
@ -3169,7 +3169,7 @@ msgid "{0, plural, one {Announcement} other {Announcements}}"
msgstr "" msgstr ""
#: src/pages/notifications.jsx:614 #: src/pages/notifications.jsx:614
#: src/pages/settings.jsx:1148 #: src/pages/settings.jsx:1153
msgid "Follow requests" msgid "Follow requests"
msgstr "" msgstr ""
@ -3524,56 +3524,56 @@ msgstr ""
msgid "Unable to copy version string" msgid "Unable to copy version string"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1045
#: src/pages/settings.jsx:1050 #: src/pages/settings.jsx:1050
#: src/pages/settings.jsx:1055
msgid "Failed to update subscription. Please try again." msgid "Failed to update subscription. Please try again."
msgstr "" msgstr ""
#: src/pages/settings.jsx:1056 #: src/pages/settings.jsx:1061
msgid "Failed to remove subscription. Please try again." msgid "Failed to remove subscription. Please try again."
msgstr "" msgstr ""
#: src/pages/settings.jsx:1063 #: src/pages/settings.jsx:1068
msgid "Push Notifications (beta)" msgid "Push Notifications (beta)"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1085 #: src/pages/settings.jsx:1090
msgid "Push notifications are blocked. Please enable them in your browser settings." msgid "Push notifications are blocked. Please enable them in your browser settings."
msgstr "" msgstr ""
#: src/pages/settings.jsx:1094 #: src/pages/settings.jsx:1099
msgid "Allow from <0>{0}</0>" msgid "Allow from <0>{0}</0>"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1103 #: src/pages/settings.jsx:1108
msgid "anyone" msgid "anyone"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1107 #: src/pages/settings.jsx:1112
msgid "people I follow" msgid "people I follow"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1111 #: src/pages/settings.jsx:1116
msgid "followers" msgid "followers"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1144 #: src/pages/settings.jsx:1149
msgid "Follows" msgid "Follows"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1152 #: src/pages/settings.jsx:1157
msgid "Polls" msgid "Polls"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1156 #: src/pages/settings.jsx:1161
msgid "Post edits" msgid "Post edits"
msgstr "" msgstr ""
#: src/pages/settings.jsx:1177 #: src/pages/settings.jsx:1182
msgid "Push permission was not granted since your last login. You'll need to <0><1>log in</1> again to grant push permission</0>." msgid "Push permission was not granted since your last login. You'll need to <0><1>log in</1> again to grant push permission</0>."
msgstr "" msgstr ""
#: src/pages/settings.jsx:1193 #: src/pages/settings.jsx:1198
msgid "NOTE: Push notifications only work for <0>one account</0>." msgid "NOTE: Push notifications only work for <0>one account</0>."
msgstr "" msgstr ""

View file

@ -913,22 +913,27 @@ async function getCachesKeys() {
async function getCachesSize() { async function getCachesSize() {
const keys = await caches.keys(); const keys = await caches.keys();
let total = {}; let total = {};
let totalSize = 0; let TOTAL = 0;
for (const key of keys) { for (const key of keys) {
const cache = await caches.open(key); const cache = await caches.open(key);
const k = await cache.keys(); const k = await cache.keys();
for (const item of k) { for (const item of k) {
const response = await cache.match(item); try {
const blob = await response.blob(); const response = await cache.match(item);
total[key] = (total[key] || 0) + blob.size; const blob = await response.blob();
totalSize += blob.size; total[key] = (total[key] || 0) + blob.size;
TOTAL += blob.size;
} catch (e) {
alert('Failed to get cache size for ' + item);
alert(e);
}
} }
} }
return { return {
...Object.fromEntries( ...Object.fromEntries(
Object.entries(total).map(([k, v]) => [k, prettyBytes(v)]), Object.entries(total).map(([k, v]) => [k, prettyBytes(v)]),
), ),
totalSize: prettyBytes(totalSize), TOTAL: prettyBytes(TOTAL),
}; };
} }