block_in_place in transcoder
This commit is contained in:
parent
0ad014a544
commit
0b98540e35
@ -120,14 +120,12 @@ async fn transcoder_task(
|
|||||||
encoding_to: EncodingRef,
|
encoding_to: EncodingRef,
|
||||||
) {
|
) {
|
||||||
while let Some(FileData { name, data }) = rx.recv().await {
|
while let Some(FileData { name, data }) = rx.recv().await {
|
||||||
let new_data = task::spawn_blocking(move || {
|
let new_data = task::block_in_place(move || {
|
||||||
let text = encoding_from.decode(&data, DecoderTrap::Ignore).unwrap();
|
let text = encoding_from.decode(&data, DecoderTrap::Ignore).unwrap();
|
||||||
encoding_to
|
encoding_to
|
||||||
.encode(text.as_str(), EncoderTrap::Ignore)
|
.encode(text.as_str(), EncoderTrap::Ignore)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
})
|
});
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
tx.send(FileData {
|
tx.send(FileData {
|
||||||
name,
|
name,
|
||||||
|
Loading…
Reference in New Issue
Block a user