#805 extract DbConn from PlumeRocket

Zamknięty
igalic chce scalić 2 commity/ów z igalic/Plume:refactor/extract-dbconn do main
igalic skomentował(-a) 4 miesięcy temu

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 zrecenzowano 4 miesięcy temu
plume-models/src/db_conn.rs
@@ -41,3 +12,1 @@
&self.0
}
}
#[database("plume")]
kiwii skomentował(-a) 4 miesięcy temu

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.
igalic skomentował(-a) 4 miesięcy temu

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 oznaczył(-a) tę rozmowę jako rozwiązaną
igalic zmieniono tytuł z add rocket_contrib as dependency na extract DbConn from PlumeRocket 4 miesięcy temu
igalic skomentował(-a) 4 miesięcy temu
Właściciel
  • 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.
igalic skomentował(-a) 4 miesięcy temu
Właściciel

closing in favour of #813

closing in favour of #813
igalic zamknął(-ęła) ten pull request 4 miesięcy temu
Otwórz ponownie ten Pull Request, aby wykonać scalenie.
Zaloguj się, aby dołączyć do tej rozmowy.
Brak recenzentów
Brak kamienia milowego
Brak przypisanych
Uczestnicy 2
Powiadomienia
Termin realizacji

Brak ustawionego terminu realizacji.

Zależności

Ten Pull Request nie zawiera w tej chwili żadnych zależności.

Ładowanie…
Nie ma jeszcze treści.