@@ -86,12 +86,10 @@ func (r *Runner) RunTaskWithRetry(task *Task, conn *pgxpool.Pool, config *config
8686 return fmt .Errorf ("task %s failed after %d retries: %w" , task .TaskType , maxRetries , lastErr )
8787}
8888
89- // runSingleTask reads the SQL file and executes it against the database.
90- // task.LodLevel drives which LOD schema and building IDs are used — -1 means no LOD context (schema setup, functions, etc.).
89+ // runSingleTask is the internal method that actually executes a task
9190func (r * Runner ) runSingleTask (task * Task , conn * pgxpool.Pool , workerID int ) error {
9291 utils .Debug .Printf ("[Worker %d] Starting task: %s (SQL file: %s)" , workerID , task .TaskType , task .SQLFile )
93-
94- data , err := os .ReadFile (task .SQLFile )
92+ sqlScript , err := r .getSQLScript (task .SQLFile )
9593 if err != nil {
9694 return fmt .Errorf ("failed to read SQL file %s: %w" , task .SQLFile , err )
9795 }
@@ -118,6 +116,14 @@ func (r *Runner) runSingleTask(task *Task, conn *pgxpool.Pool, workerID int) err
118116 return nil
119117}
120118
119+ func (r * Runner ) getSQLScript (path string ) (string , error ) {
120+ data , err := os .ReadFile (path )
121+ if err != nil {
122+ return "" , err
123+ }
124+ return string (data ), nil
125+ }
126+
121127// isDeadlockError checks if the error is a PostgreSQL deadlock error
122128func isDeadlockError (err error ) bool {
123129 if err == nil {
@@ -128,4 +134,3 @@ func isDeadlockError(err error) bool {
128134 return strings .Contains (errStr , "deadlock detected" ) ||
129135 strings .Contains (errStr , "sqlstate 40p01" )
130136}
131-
0 commit comments