Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: downstream http caching plugin #283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

feat: http caching plugin

e0bdfd2
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Open

feat: downstream http caching plugin #283

feat: http caching plugin
e0bdfd2
Select commit
Loading
Failed to load commit list.
GitHub Actions / clippy succeeded Mar 21, 2024 in 0s

clippy

12 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 12
Note 0
Help 0

Versions

  • rustc 1.75.0 (82e1608df 2023-12-21)
  • cargo 1.75.0 (1d8b05cdd 2023-11-20)
  • clippy 0.1.75 (82e1608 2023-12-21)

Annotations

Check warning on line 287 in libs/engine/src/schema_awareness.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> libs/engine/src/schema_awareness.rs:287:53
    |
287 |         let introspection = parse_introspection_str(&content).map_err(|source| {
    |                                                     ^^^^^^^^ help: change this to: `content`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 207 in libs/engine/src/schema_awareness.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> libs/engine/src/schema_awareness.rs:207:30
    |
207 |         parse_graphql_schema(&content).map(|schema| (content.clone(), schema))
    |                              ^^^^^^^^ help: change this to: `content`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

Check warning on line 91 in plugins/http_caching/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

warning: returning the result of a `let` binding from a block
  --> plugins/http_caching/src/plugin.rs:91:11
   |
82 | / ...   let t = match ret {
83 | | ...     vrl::value::Value::Bytes(v) => String::from_utf8(v.to_vec()).ok(),
84 | | ...     _ => {
85 | | ...       tracing::error!("HttpCachingPlugin::vrl::session_builder must return a string, but returned a non-string value: {:?}, ignoring....
...  |
88 | | ...     }
89 | | ...   };
   | |________- unnecessary `let` binding
90 |   ...
91 |   ...   t
   |         ^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
   = note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
   |
82 ~           
83 | 
84 ~           match ret {
85 +             vrl::value::Value::Bytes(v) => String::from_utf8(v.to_vec()).ok(),
86 +             _ => {
87 +               tracing::error!("HttpCachingPlugin::vrl::session_builder must return a string, but returned a non-string value: {:?}, ignoring...", ret);
88 + 
89 +               None
90 +             }
91 +           }
   |

Check warning on line 23 in plugins/http_caching/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

associated function `generate_cache_key` is never used

warning: associated function `generate_cache_key` is never used
  --> plugins/http_caching/src/plugin.rs:23:6
   |
22 | impl HttpCachingPlugin {
   | ---------------------- associated function in this implementation
23 |   fn generate_cache_key(request: &ConductorHttpRequest) -> String {
   |      ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Check warning on line 66 in plugins/http_caching/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `ctx`

warning: unused variable: `ctx`
  --> plugins/http_caching/src/plugin.rs:66:30
   |
66 |   fn default_session_builder(ctx: &mut RequestExecutionContext) -> String {
   |                              ^^^ help: if this is intentional, prefix it with an underscore: `_ctx`
   |
   = note: `#[warn(unused_variables)]` on by default

Check warning on line 4 in plugins/http_caching/src/plugin.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `anyhow::anyhow`

warning: unused import: `anyhow::anyhow`
 --> plugins/http_caching/src/plugin.rs:4:5
  |
4 | use anyhow::anyhow;
  |     ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Check warning on line 21 in libs/common/src/execute.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this lifetime isn't used in the impl

warning: this lifetime isn't used in the impl
  --> libs/common/src/execute.rs:21:6
   |
21 | impl<'a> RequestExecutionContext {
   |      ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
   = note: `#[warn(clippy::extra_unused_lifetimes)]` on by default

Check warning on line 47 in libs/cache/src/stores/cloudflare_kv.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `MutexGuard` is held across an `await` point

warning: this `MutexGuard` is held across an `await` point
  --> libs/cache/src/stores/cloudflare_kv.rs:47:9
   |
47 |     let kv_store = self.kv_store.lock().unwrap();
   |         ^^^^^^^^
   |
   = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
note: these are all the `await` points this lock is held through
  --> libs/cache/src/stores/cloudflare_kv.rs:53:8
   |
53 |       .await
   |        ^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock

Check warning on line 36 in libs/cache/src/stores/cloudflare_kv.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `MutexGuard` is held across an `await` point

warning: this `MutexGuard` is held across an `await` point
  --> libs/cache/src/stores/cloudflare_kv.rs:36:9
   |
36 |     let kv_store = self.kv_store.lock().unwrap();
   |         ^^^^^^^^
   |
   = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
note: these are all the `await` points this lock is held through
  --> libs/cache/src/stores/cloudflare_kv.rs:37:36
   |
37 |     match kv_store.get(key).text().await {
   |                                    ^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock

Check warning on line 27 in libs/cache/src/stores/cloudflare_kv.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of an `Arc` that is not `Send` or `Sync`

warning: usage of an `Arc` that is not `Send` or `Sync`
  --> libs/cache/src/stores/cloudflare_kv.rs:27:17
   |
27 |       kv_store: Arc::new(Mutex::new(kv_store)),
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: the trait `Send` is not implemented for `Mutex<KvStore>`
   = note: the trait `Sync` is not implemented for `Mutex<KvStore>`
   = note: required for `Arc<Mutex<KvStore>>` to implement `Send` and `Sync`
   = help: consider using an `Rc` instead or wrapping the inner type with a `Mutex`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync
   = note: `#[warn(clippy::arc_with_non_send_sync)]` on by default

Check warning on line 109 in libs/cache/src/cache_manager.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `MutexGuard` is held across an `await` point

warning: this `MutexGuard` is held across an `await` point
   --> libs/cache/src/cache_manager.rs:109:15
    |
109 |     if let Ok(mut store) = self.store.lock() {
    |               ^^^^^^^^^
    |
    = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
note: these are all the `await` points this lock is held through
   --> libs/cache/src/cache_manager.rs:110:60
    |
110 |       store.set(key, serde_json::to_value(value).unwrap()).await;
    |                                                            ^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock

Check warning on line 98 in libs/cache/src/cache_manager.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `MutexGuard` is held across an `await` point

warning: this `MutexGuard` is held across an `await` point
   --> libs/cache/src/cache_manager.rs:98:15
    |
98  |     if let Ok(mut store) = self.store.lock() {
    |               ^^^^^^^^^
    |
    = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
note: these are all the `await` points this lock is held through
   --> libs/cache/src/cache_manager.rs:101:10
    |
101 |         .await
    |          ^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock
    = note: `#[warn(clippy::await_holding_lock)]` on by default