Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
1e1402d2
Commit
1e1402d2
authored
21 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Added lines_per_yield (defaults to 10) for importing newsgroup articles, no
longer consume 100% CPU while importing.
parent
10c15891
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/newslink.js
+8
-0
8 additions, 0 deletions
exec/newslink.js
with
8 additions
and
0 deletions
exec/newslink.js
+
8
−
0
View file @
1e1402d2
...
...
@@ -47,6 +47,7 @@ var reset_export_ptrs = false; // Reset export pointers, export all messages
var
update_export_ptrs
=
false
;
// Update export pointers, don't export anything
var
email_addresses
=
true
;
// Include e-mail addresses in headers
var
import_amount
=
0
;
// Import a fixed number of messages per group
var
lines_per_yield
=
10
;
// Release time-slices ever x number of lines
// Parse arguments
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
...
...
@@ -153,6 +154,9 @@ while(!cfg_file.eof) {
tagline
=
str
.
join
(
'
'
);
// Combine remaining elements (tagline)
tagline
+=
"
\r\n
"
;
break
;
case
"
lines_per_yield
"
:
lines_per_yield
=
Number
(
str
[
1
]);
break
;
default
:
printf
(
"
!UNRECOGNIZED configuration keyword: %s
\r\n
"
,
str
[
0
]);
break
;
...
...
@@ -427,6 +431,7 @@ for(i in area) {
body
=
""
;
header
=
true
;
var
hdr
=
{
from
:
""
,
to
:
newsgroup
,
subject
:
""
,
id
:
""
};
var
line_counter
=
0
;
while
(
socket
.
is_connected
)
{
line
=
socket
.
recvline
(
512
/*maxlen*/
,
300
/*timeout*/
);
...
...
@@ -452,6 +457,9 @@ for(i in area) {
line
=
line
.
slice
(
1
);
// Skip prepended dots
body
+=
line
;
body
+=
"
\r\n
"
;
line_counter
++
;
if
(
lines_per_yield
&&
(
line_counter
%
lines_per_yield
)
==
0
)
sleep
(
1
);
continue
;
}
//print(line);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment