Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Discover
Commits
c237403e
Commit
c237403e
authored
Oct 11, 2022
by
Aleix Pol Gonzalez
🐧
Browse files
flatpak: Improve flatpaktest reliability
Do not destroy the installations after we've waited for the threads to finish.
parent
6179f2f7
Pipeline
#247230
passed with stage
in 3 minutes and 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
View file @
c237403e
...
...
@@ -304,13 +304,14 @@ FlatpakBackend::FlatpakBackend(QObject *parent)
FlatpakBackend
::~
FlatpakBackend
()
{
g_cancellable_cancel
(
m_cancellable
);
for
(
auto
inst
:
qAsConst
(
m_installations
))
g_object_unref
(
inst
);
if
(
!
m_threadPool
.
waitForDone
(
200
))
{
qDebug
()
<<
"could not kill them all"
<<
m_threadPool
.
activeThreadCount
();
}
m_threadPool
.
clear
();
for
(
auto
inst
:
qAsConst
(
m_installations
))
g_object_unref
(
inst
);
m_installations
.
clear
();
g_object_unref
(
m_cancellable
);
}
...
...
@@ -1421,6 +1422,10 @@ ResultsStream *FlatpakBackend::search(const AbstractResourcesBackend::Filters &f
auto
cancellable
=
m_cancellable
;
fw
->
setFuture
(
QtConcurrent
::
run
(
&
m_threadPool
,
[
installations
,
cancellable
]
{
QHash
<
FlatpakInstallation
*
,
QVector
<
FlatpakInstalledRef
*>>
ret
;
if
(
g_cancellable_is_cancelled
(
cancellable
))
{
qWarning
()
<<
"Job cancelled"
;
return
ret
;
}
for
(
auto
installation
:
installations
)
{
g_autoptr
(
GError
)
localError
=
nullptr
;
...
...
@@ -1431,7 +1436,8 @@ ResultsStream *FlatpakBackend::search(const AbstractResourcesBackend::Filters &f
}
if
(
g_cancellable_is_cancelled
(
cancellable
))
{
qWarning
()
<<
"Job cancelled"
;
return
ret
;
ret
.
clear
();
break
;
}
auto
&
current
=
ret
[
installation
];
...
...
libdiscover/backends/FlatpakBackend/FlatpakFetchDataJob.cpp
View file @
c237403e
...
...
@@ -12,7 +12,7 @@ namespace FlatpakRunnables
FlatpakRemoteRef
*
findRemoteRef
(
FlatpakResource
*
app
,
GCancellable
*
cancellable
)
{
if
(
app
->
origin
().
isEmpty
())
{
qWarning
(
)
<<
"Failed to get metadata file because of missing origin"
;
qWarning
(
"Failed to get metadata file because of missing origin"
)
;
return
nullptr
;
}
...
...
@@ -28,9 +28,8 @@ FlatpakRemoteRef *findRemoteRef(FlatpakResource *app, GCancellable *cancellable)
FLATPAK_QUERY_FLAGS_ONLY_CACHED
,
cancellable
,
&
localError
);
if
(
!
ret
)
{
qWarning
()
<<
"Failed to find:"
<<
app
->
ref
()
<<
"in"
<<
origin
<<
localError
->
message
;
return
{};
if
(
localError
)
{
qWarning
(
"Failed to find ref"
);
}
return
ret
;
}
...
...
@@ -39,7 +38,10 @@ QByteArray fetchMetadata(FlatpakResource *app, GCancellable *cancellable)
{
FlatpakRemoteRef
*
remoteRef
=
findRemoteRef
(
app
,
cancellable
);
if
(
!
remoteRef
)
{
qDebug
()
<<
"failed to find the remote"
<<
app
->
name
();
if
(
!
g_cancellable_is_cancelled
(
cancellable
))
{
qDebug
()
<<
"failed to find the remote"
<<
app
->
name
();
}
return
{};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment