-
-
Notifications
You must be signed in to change notification settings - Fork 202
2.8.8 #3414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.8.8 #3414
Changes from all commits
3d351a7
1d51b60
f01599e
2cb8d62
cfa24d9
bcd9ded
d4a7e4c
d3d551c
654c456
41a8849
c57c250
fc67bb0
440f5b1
a4ec01a
bef1e54
680612c
60fe6dd
392a138
ad81bd8
a94a875
9338ca4
f26c112
7f7d2a6
88e95b0
fe38b96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,15 +48,26 @@ function setOptions() { | |
| /* | ||
| * Function gets all QSOs from given station_id, that are not previously uploaded to hrdlog. | ||
| * Adif is build for each qso, and then uploaded, one at a time | ||
| * Uses batch fetching to prevent memory exhaustion with large datasets | ||
| */ | ||
| function mass_upload_qsos($station_id, $hrdlog_username, $hrdlog_code) { | ||
| $i = 0; | ||
| $data['qsos'] = $this->logbook_model->get_hrdlog_qsos($station_id); | ||
| $errormessages = array(); | ||
| $batch_size = 1000; | ||
| $offset = 0; | ||
| $has_more_qsos = true; | ||
|
|
||
| $this->load->library('AdifHelper'); | ||
|
|
||
| if ($data['qsos']) { | ||
| // Process QSOs in batches to prevent memory exhaustion | ||
| while ($has_more_qsos) { | ||
| $data['qsos'] = $this->logbook_model->get_hrdlog_qsos($station_id, $batch_size, $offset); | ||
|
|
||
| if (!$data['qsos'] || $data['qsos']->num_rows() == 0) { | ||
| $has_more_qsos = false; | ||
| break; | ||
| } | ||
|
|
||
| foreach ($data['qsos']->result() as $qso) { | ||
| $adif = $this->adifhelper->getAdifLine($qso); | ||
|
|
||
|
|
@@ -76,26 +87,34 @@ function mass_upload_qsos($station_id, $hrdlog_username, $hrdlog_code) { | |
| log_message('error', 'hrdlog upload stopped for Station_ID: ' . $station_id); | ||
| $errormessages[] = $result['message'] . 'Invalid HRDLog-Code, stopped at Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON; | ||
| $result['status'] = 'Error'; | ||
| break; /* If key is invalid, immediate stop syncing for more QSOs of this station */ | ||
| break 2; /* If key is invalid, immediate stop syncing for more QSOs of this station */ | ||
| } else { | ||
| log_message('error', 'hrdlog upload failed for qso: Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON); | ||
| log_message('error', 'hrdlog upload failed with the following message: ' . $result['message']); | ||
| $result['status'] = 'Error'; | ||
| $errormessages[] = $result['message'] . ' Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON; | ||
| } | ||
| } | ||
| if ($i == 0) { | ||
| $result['status']='Error'; | ||
|
|
||
| // Check if we got a full batch - if not, we've reached the end | ||
| if ($data['qsos']->num_rows() < $batch_size) { | ||
| $has_more_qsos = false; | ||
| } else { | ||
| $offset += $batch_size; | ||
| log_message('info', 'HRDLog batch upload: Processed ' . $offset . ' QSOs so far for station_id: ' . $station_id); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Offset-based batch pagination skips QSOs mid-uploadHigh Severity Both Additional Locations (1) |
||
| } | ||
| $result['count'] = $i; | ||
| $result['errormessages'] = $errormessages; | ||
| return $result; | ||
| } else { | ||
| $result['status'] = 'Error'; | ||
| $result['count'] = $i; | ||
| $result['errormessages'] = $errormessages; | ||
| return $result; | ||
| } | ||
| } | ||
|
|
||
| if ($i > 0) { | ||
| log_message('info', 'HRDLog upload completed: Total of ' . $i . ' QSOs successfully uploaded for station_id: ' . $station_id); | ||
| } | ||
|
|
||
| if ($i == 0) { | ||
| $result['status']='Error'; | ||
| } | ||
| $result['count'] = $i; | ||
| $result['errormessages'] = $errormessages; | ||
| return $result; | ||
| } | ||
|
|
||
| /* | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Batch eQSL marks lost when redirect fires mid-loop
High Severity
The batch update of
$successful_uploadsonly runs after the entireforeachloop completes. However,uploadQso()callsredirect()directly on several error conditions (auth failure, 500, 400, format error). When a redirect fires mid-loop, PHP exits before reaching the batcheqsl_mark_sent_batch()call, so any QSOs already successfully uploaded in that session are never marked as sent in the database. Those QSOs will be re-uploaded on the next export, causing duplicates on eQSL. The original code calledeqsl_mark_sent()immediately on each success, avoiding this problem.Additional Locations (1)
application/controllers/Eqsl.php#L243-L270