Skip to content

Commit aa1cae0

Browse files
committed
log, debug - Add more debug step log messages to track SassCache creation and reuse.
1 parent 6645d55 commit aa1cae0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/core/sass/cache.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,20 @@ class SassCache implements Cloneable<SassCache> {
145145
// add a cleanup method to register a cleanup handler
146146
cleanup(temp: TempContext | undefined) {
147147
const registerCleanup = temp ? temp.onCleanup : onCleanup;
148+
const cachePath = this.path;
148149
registerCleanup(() => {
150+
log.debug(`SassCache cleanup EXECUTING for ${cachePath}`);
149151
try {
150152
this.kv.close();
153+
log.debug(`SassCache KV closed for ${cachePath}`);
151154
if (temp) safeRemoveIfExists(this.path);
152155
} catch (error) {
153156
log.info(
154157
`Error occurred during sass cache cleanup for ${this.path}: ${error}`,
155158
);
156159
}
157160
});
161+
log.debug(`SassCache cleanup REGISTERED for ${cachePath}`);
158162
}
159163
}
160164

@@ -199,14 +203,16 @@ export async function sassCache(
199203
temp: TempContext | undefined,
200204
): Promise<SassCache> {
201205
if (!_sassCache[path]) {
202-
log.debug(`Creating SassCache at ${path}`);
206+
log.debug(`Creating NEW SassCache at ${path}`);
203207
ensureDirSync(path);
204208
const kvFile = join(path, "sass.kv");
205209
const kv = await Deno.openKv(kvFile);
206210
await checkVersion(kv, kvFile);
207211
_sassCache[path] = new SassCache(kv, path);
208212
// register cleanup for this cache
209213
_sassCache[path].cleanup(temp);
214+
} else {
215+
log.debug(`Found EXISTING SassCache entry for ${path} (may be stale if KV was closed)`);
210216
}
211217
log.debug(`Returning SassCache at ${path}`);
212218
const result = _sassCache[path];

0 commit comments

Comments
 (0)