#805 extract DbConn from PlumeRocket

クローズ
igalicigalic/Plume:refactor/extract-dbconn から main への 2 コミットのマージを希望しています
igalic4ヶ月前 にコメント

in the following Pull Request, we’lle extract DbConn from PlumeRocket, as suggested in #797

  • use rocket_contrib’s #[database] to implement our DbConn
  • we do not use #[database]'s connection setup, retaining our own init_pool() and ConnectionCustomization!
  • pass DbConn in as ref instead of Copying it around.
in the following Pull Request, we'lle extract `DbConn` from `PlumeRocket`, as suggested in https://git.joinplu.me/Plume/Plume/issues/797 - use rocket_contrib's `#[database]` to implement our `DbConn` - we do *not* use `#[database]`'s connection setup, retaining our own `init_pool()` and `ConnectionCustomization`! - pass `DbConn` in as `ref` instead of `Copy`ing it around.
kiwii がレビュー 4ヶ月前
plume-models/src/db_conn.rs
@@ -41,3 +12,1 @@
&self.0
}
}
#[database("plume")]
kiwii4ヶ月前 にコメント

I think you’ll have to edit plume-models/src/config.rs so that Rocket knows the URL of this “plume” database.

I think you'll have to edit `plume-models/src/config.rs` so that Rocket knows the URL of this "plume" database.
igalic4ヶ月前 にコメント

yesno… we want to retain our ConnectionCustomization, so we’re keeping our own init_pool().

yesno… we want to retain our `ConnectionCustomization`, so we're keeping our own `init_pool()`.
igalic がこの会話を解決済みにしました
igalic がタイトルを add rocket_contrib as dependency から extract DbConn from PlumeRocket に変更 4ヶ月前
igalic4ヶ月前 にコメント
オーナー
  • pass DbConn in as ref instead of Copying it around.

This will help with the async migration, as we’re currently passing all of PlumeRocket around as ref, which means that it ends up sitting somewhere in a function, until it’s .awaited.

This can create lead us into a big mess, which may be impossible to untangle, so this should help not running into that to begin with.

> - pass `DbConn` in as `ref` instead of `Copy`ing it around. This will help with the `async` migration, as we're currently passing all of PlumeRocket around as `ref`, which means that it ends up sitting *somewhere* in a function, until it's `.await`ed. This can create lead us into a big mess, which may be impossible to untangle, so this should help *not* running into that to begin with.
igalic4ヶ月前 にコメント
オーナー

closing in favour of #813

closing in favour of #813
igalic がプルリクエストをクローズ 4ヶ月前
このプルリクエストをマージする場合は再オープンしてください。
サインインしてこの会話に参加。
レビューアなし
マイルストーンなし
担当者なし
2 人の参加者
通知
期日

期日は未設定です。

依存関係

このプルリクエストに依存関係はありません。

読み込み中…
まだ内容がありません