Skip to content

Commit eee6df4

Browse files
committed
Move futures to heap with Box::pin to avoid stack overflow
1 parent 8e89d48 commit eee6df4

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

crates/pixi_api/src/context.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ impl<I: Interface> WorkspaceContext<I> {
143143
dep_options: DependencyOptions,
144144
git_options: GitOptions,
145145
) -> miette::Result<Option<UpdateDeps>> {
146-
crate::workspace::add::add_conda_dep(
146+
Box::pin(crate::workspace::add::add_conda_dep(
147147
self.workspace_mut()?,
148148
specs,
149149
spec_type,
150150
dep_options,
151151
git_options,
152-
)
152+
))
153153
.await
154154
}
155155

@@ -159,8 +159,13 @@ impl<I: Interface> WorkspaceContext<I> {
159159
editable: bool,
160160
options: DependencyOptions,
161161
) -> miette::Result<Option<UpdateDeps>> {
162-
crate::workspace::add::add_pypi_dep(self.workspace_mut()?, pypi_deps, editable, options)
163-
.await
162+
Box::pin(crate::workspace::add::add_pypi_dep(
163+
self.workspace_mut()?,
164+
pypi_deps,
165+
editable,
166+
options,
167+
))
168+
.await
164169
}
165170

166171
pub async fn remove_conda_deps(
@@ -169,12 +174,12 @@ impl<I: Interface> WorkspaceContext<I> {
169174
spec_type: SpecType,
170175
dep_options: DependencyOptions,
171176
) -> miette::Result<()> {
172-
crate::workspace::remove::remove_conda_deps(
177+
Box::pin(crate::workspace::remove::remove_conda_deps(
173178
self.workspace_mut()?,
174179
specs,
175180
spec_type,
176181
dep_options,
177-
)
182+
))
178183
.await
179184
}
180185

@@ -183,7 +188,12 @@ impl<I: Interface> WorkspaceContext<I> {
183188
pypi_deps: PypiDeps,
184189
options: DependencyOptions,
185190
) -> miette::Result<()> {
186-
crate::workspace::remove::remove_pypi_deps(self.workspace_mut()?, pypi_deps, options).await
191+
Box::pin(crate::workspace::remove::remove_pypi_deps(
192+
self.workspace_mut()?,
193+
pypi_deps,
194+
options,
195+
))
196+
.await
187197
}
188198

189199
pub async fn reinstall(

0 commit comments

Comments
 (0)