Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
098008e7
Valider
098008e7
rédigé
Il y a 3 mois
par
Elliu
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
SEARCH: fix tokio::spawn spawning block_on calling function
parent
14168697
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
lektord/src/app/routes.rs
+4
-3
4 ajouts, 3 suppressions
lektord/src/app/routes.rs
avec
4 ajouts
et
3 suppressions
lektord/src/app/routes.rs
+
4
−
3
Voir le fichier @
098008e7
...
@@ -21,6 +21,7 @@ use lektor_utils::decode_base64_json;
...
@@ -21,6 +21,7 @@ use lektor_utils::decode_base64_json;
use
rand
::
seq
::
SliceRandom
;
use
rand
::
seq
::
SliceRandom
;
use
std
::
ops
::
RangeBounds
;
use
std
::
ops
::
RangeBounds
;
use
tokio
::
task
::
LocalSet
;
use
tokio
::
task
::
LocalSet
;
use
tokio
::
task
::
spawn_blocking
;
/// Get informations abount the lektord server.
/// Get informations abount the lektord server.
#[axum::debug_handler(state
=
LektorStatePtr)]
#[axum::debug_handler(state
=
LektorStatePtr)]
...
@@ -557,7 +558,7 @@ macro_rules! extractor {
...
@@ -557,7 +558,7 @@ macro_rules! extractor {
=>
{
$
(
$match_pat:pat
=>
$match_handle:expr
,)
+
}
=>
{
$
(
$match_pat:pat
=>
$match_handle:expr
,)
+
}
=>
|
$arg:ident
|
$handle:expr
$
(,)
?
=>
|
$arg:ident
|
$handle:expr
$
(,)
?
)
=>
{
)
=>
{
async
move
{
move
||
{
tokio
::
runtime
::
Builder
::
new_current_thread
()
tokio
::
runtime
::
Builder
::
new_current_thread
()
.build
()
.build
()
.context
(
"failed to build the runtime"
)
?
.context
(
"failed to build the runtime"
)
?
...
@@ -578,7 +579,7 @@ pub(crate) async fn search(
...
@@ -578,7 +579,7 @@ pub(crate) async fn search(
Path
(
uri
):
Path
<
String
>
,
Path
(
uri
):
Path
<
String
>
,
)
->
Result
<
Json
<
Vec
<
KId
>>
,
LektordError
>
{
)
->
Result
<
Json
<
Vec
<
KId
>>
,
LektordError
>
{
let
SearchData
{
from
,
regex
}
=
decode_base64_json
(
uri
)
?
;
let
SearchData
{
from
,
regex
}
=
decode_base64_json
(
uri
)
?
;
Ok
(
tokio
::
spawn
(
extractor!
{
Ok
(
spawn_blocking
(
extractor!
{
match
from
match
from
=>
{
=>
{
SearchFrom
::
Database
=>
search_adaptors
::
database_extractor
(
&
state
)
.await
,
SearchFrom
::
Database
=>
search_adaptors
::
database_extractor
(
&
state
)
.await
,
...
@@ -603,7 +604,7 @@ pub(crate) async fn count(
...
@@ -603,7 +604,7 @@ pub(crate) async fn count(
Path
(
uri
):
Path
<
String
>
,
Path
(
uri
):
Path
<
String
>
,
)
->
Result
<
Json
<
usize
>
,
LektordError
>
{
)
->
Result
<
Json
<
usize
>
,
LektordError
>
{
let
SearchData
{
from
,
regex
}
=
decode_base64_json
(
uri
)
?
;
let
SearchData
{
from
,
regex
}
=
decode_base64_json
(
uri
)
?
;
Ok
(
tokio
::
spawn
(
extractor!
{
Ok
(
spawn_blocking
(
extractor!
{
match
from
match
from
=>
{
=>
{
SearchFrom
::
Database
=>
search_adaptors
::
database_extractor
(
&
state
)
.await
,
SearchFrom
::
Database
=>
search_adaptors
::
database_extractor
(
&
state
)
.await
,
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter