Skip to content

Commit e29e5d2

Browse files
committed
fix: fixed response caching functions
These were still expecting `.perseus/`, and would've created a top-level `cache/` directory. That'll now be created in `dist/`.
1 parent e1c9ad3 commit e29e5d2

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

packages/perseus/src/utils/cache_res.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt};
1818
/// When running automated tests, you may wish to set `force_run` to the result
1919
/// of an environment variable check that you'll use when testing.
2020
///
21-
/// This function expects to be run in the context of `.perseus/`, or any
22-
/// directory in which a folder `cache/` is available. If you're using Perseus
23-
/// without the CLI and you don't want that directory to exist, you shouldn't
24-
/// use this function.
25-
///
2621
/// # Panics
2722
/// If this filesystem operations fail, this function will panic. It can't
2823
/// return a graceful error since it's expected to return the type you
@@ -54,7 +49,7 @@ where
5449
// In production, we'll just run the function directly
5550
if cfg!(debug_assertions) {
5651
// Check if the cache file exists
57-
let filename = format!("cache/{}.json", &name);
52+
let filename = format!("dist/cache/{}.json", &name);
5853
match File::open(&filename).await {
5954
Ok(mut file) => {
6055
if force_run {
@@ -129,7 +124,7 @@ where
129124
}
130125
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
131126
// The file doesn't exist yet, create the parent cache directory
132-
create_dir_all("cache")
127+
create_dir_all("dist/cache")
133128
.await
134129
.unwrap_or_else(|err| panic!("couldn't create cache directory: {}", err));
135130
// We have no cache, so we'll have to run the function

0 commit comments

Comments
 (0)