Skip to content

Commit 4addd6f

Browse files
committed
📘 doc: update CHANGELOG
1 parent ab37c4d commit 4addd6f

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# 1.4.8
1+
# 1.4.8 - 27 Sep 2025
2+
Improvement:
3+
- automatically clear up sucrose cache when not used
4+
- remove `Bun.hash` from checksum calculation
5+
26
Change:
37
- make `file-type` optional to reduce bundle size
48
- [#1432](https://github.com/elysiajs/elysia/pull/1432) missing context (set) in mapResponse for ElysiaFile

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "elysia",
33
"description": "Ergonomic Framework for Human",
4-
"version": "1.4.7",
4+
"version": "1.4.8",
55
"author": {
66
"name": "saltyAom",
77
"url": "https://github.com/SaltyAom",

src/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type { Context, PreContext } from './context'
1313

1414
import { t } from './type-system'
1515
import {
16-
clearSucroseCache,
1716
mergeInference,
1817
sucrose,
1918
type Sucrose
@@ -8130,12 +8129,6 @@ export default class Elysia<
81308129
) => {
81318130
this['~adapter'].listen(this)(options, callback)
81328131

8133-
if (this.promisedModules.size) clearSucroseCache(5000)
8134-
8135-
this.promisedModules.then(() => {
8136-
clearSucroseCache(1000)
8137-
})
8138-
81398132
return this
81408133
}
81418134

src/sucrose.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,15 +642,19 @@ export const sucrose = (
642642
if (typeof event !== 'function') continue
643643

644644
const content = event.toString()
645-
console.log(content)
646645
const key = checksum(content)
647-
console.log(key)
648646
const cachedInference = caches[key]
649647
if (cachedInference) {
650648
inference = mergeInference(inference, cachedInference)
651649
continue
652650
}
653651

652+
// If no sucrose usage is found in 4:55 minutes
653+
// it's likely that server is either idle or
654+
// no new compilation is happening
655+
// Clear the cache to free up memory
656+
clearSucroseCache(4 * 60 * 1000 + 55 * 1000)
657+
654658
const fnInference: Sucrose.Inference = {
655659
query: false,
656660
headers: false,

src/utils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,6 @@ const hasBunHash = isBun && typeof Bun.hash === 'function'
392392

393393
// https://stackoverflow.com/a/52171480
394394
export const checksum = (s: string) => {
395-
if (hasBunHash) return Bun.hash(s) as unknown as number
396-
397395
let h = 9
398396

399397
for (let i = 0; i < s.length; ) h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9)

0 commit comments

Comments
 (0)