This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new a3c042889 fix: return error in extract issues subtask when mysql
connection error happens (#8402)
a3c042889 is described below
commit a3c042889349bacd3e5cb6c82c6302f943af1f65
Author: Caio Queiroz <[email protected]>
AuthorDate: Mon Apr 28 04:32:05 2025 -0300
fix: return error in extract issues subtask when mysql connection error
happens (#8402)
---
backend/core/dal/dal.go | 4 ++++
backend/helpers/pluginhelper/api/api_extractor_stateful.go | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/backend/core/dal/dal.go b/backend/core/dal/dal.go
index 6523a54e6..d2ffe505f 100644
--- a/backend/core/dal/dal.go
+++ b/backend/core/dal/dal.go
@@ -241,6 +241,10 @@ type Rows interface {
// ColumnTypes returns column information such as column type, length,
// and nullable. Some information may not be available from some
drivers.
ColumnTypes() ([]*sql.ColumnType, error)
+
+ // Err returns the error, if any, that was encountered during iteration.
+ // Err may be called after an explicit or implicit Close method.
+ Err() error
}
// GetColumnNames returns table Column Names in database
diff --git a/backend/helpers/pluginhelper/api/api_extractor_stateful.go
b/backend/helpers/pluginhelper/api/api_extractor_stateful.go
index 2c994afdb..43a30d501 100644
--- a/backend/helpers/pluginhelper/api/api_extractor_stateful.go
+++ b/backend/helpers/pluginhelper/api/api_extractor_stateful.go
@@ -124,7 +124,8 @@ func (extractor *StatefulApiExtractor[InputType]) Execute()
errors.Error {
if err != nil {
return errors.Default.Wrap(err, "error running DB query")
}
- logger.Info("get data from %s where params=%s and got %d", table,
params, count)
+ logger.Info("get data from %s where params=%s and got %d with clauses
%+v", table, params, count, clauses)
+
defer cursor.Close()
// batch save divider
divider := NewBatchSaveDivider(extractor.SubTaskContext,
extractor.GetBatchSize(), table, params)
@@ -183,6 +184,9 @@ func (extractor *StatefulApiExtractor[InputType]) Execute()
errors.Error {
}
extractor.IncProgress(1)
}
+ if err := cursor.Err(); err != nil {
+ return errors.Default.Wrap(err, "error occurred during database
cursor iteration in StatefulApiExtractor")
+ }
// save the last batches
err = divider.Close()