spacer.png, 0 kB
  May 23, 2013, 19:21:43

 
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: NZB file priority  (Read 2501 times)
Reab4

Posts: 126


View Profile
« on: January 27, 2010, 08:09:53 »

I notice that the NZB button action results in two tasks:
 - the actual 'adding download data for ....'
 - make NZB
The first is almost instantaneous (I think) but the make NZB can take quite a while.
Is it possible to give this some higher priority in the task list or even make the whole action instantaneous?
Logged
spearhead
Administrator
*
Posts: 1038


View Profile WWW
« Reply #1 on: January 27, 2010, 19:18:27 »

Yes, but keep in mind that these functions are multipurpose. The adddate command is also used for other tasks, eg downloading. and for make NZB it may also have to download another NZB file from an RSS feed first. So the second has to wait for the first to complete. It uses a lock for that and it polls for that after the second thread has been been started. If not it reschedules the thread with a delay.

Currently there is no easy way to change this. (If only php had multi-threading support...).

What you could do is toy a little with these functions in urdd/urdd_functions.php :
reschedule_locked_item()
schedule_locked_item()

And change the value of 15 in the line below (20 in the second)
Code:
$offset = $item->get_preview() ? 2 : 15;
perhaps 10 or so would better suit your system. Better not change the 2 here, tho.

Logged
Reab4

Posts: 126


View Profile
« Reply #2 on: January 28, 2010, 09:18:49 »

I'm not sure the delay is the issue.
It looks like the pending 'Make NZB' thread ends up on the bottom of the to do list. I.e. after all pending Expiring, Updating and Generating Sets threads, which can take quite a long time, over 1 hour.
If it was possible to automatically do what I tend to do manually, i.e. push the 'play' button on the right of the thread in the task list to just put it on top of the list, it starts after the current thread finishes. That would be fast enough.
Logged
spearhead
Administrator
*
Posts: 1038


View Profile WWW
« Reply #3 on: January 28, 2010, 11:00:20 »

You may have a look at admin/config
Maximum number of total threads:    
Maximum number of NNTP connections:    
Maximum database intensive threads:

And make sure that the max total threads is at least 1 larger than Maximum number of NNTP connections: and   Maximum database intensive threads: together. More is also good.

Maximum number of total threads:    7 (all threads together)
Maximum number of NNTP connections:    5 (the sum of all connections you want to be able to run in parallel for all usenet servers)
Maximum database intensive threads: 1 (generally a good idea)

I can change the default priority too probably.
Logged
Reab4

Posts: 126


View Profile
« Reply #4 on: January 28, 2010, 12:45:08 »

I had total threads set to: 2
NNTP to: 1
database intensive to: 1

I still have issues with the provider complaining about too many threads in use, even with nntp set to 1. I'll set the total to 5 and see what happens.

Edit-
Didn't help.
« Last Edit: January 28, 2010, 12:53:26 by Reab4 » Logged
spearhead
Administrator
*
Posts: 1038


View Profile WWW
« Reply #5 on: January 28, 2010, 14:29:48 »

The nntp and create nzb functions are independent. creating NZB does not use a nntp thread.

Perhaps you have other programs running that also use a connection to the news server. Unlike URD programs like PAN keep connections opened even if they are not doing anything.

running
netstat -atn|grep 119
will show if any connections to the news server on that machine. If you have more than one using the same account, check them all.
Logged
Reab4

Posts: 126


View Profile
« Reply #6 on: January 28, 2010, 15:26:23 »

I'll check it later.
I use hellanzb with 6 connections open on an ssl port.
The provider allows 8 connections in total. URD is using 1, which totals 7 and leaves one spare in case of software problems.
But I kind of accepted these errors - the 'connection terminated, limit reached' notes come once or twice a day (even if hellanzb is not running), which seems a compromise. I.e. it doesn't look nice but I don't care anymore.

Logged
spearhead
Administrator
*
Posts: 1038


View Profile WWW
« Reply #7 on: January 30, 2010, 00:11:32 »

I found a bug in URD that may have sth to do with this. There are 2 lines you have to change slightly in functions/libs/socket.php:

in function is_writeable()  line 299 change :
Code:
if (count($rv) > 0)
to
Code:
if (count($w) > 0)

and in function is_readable() line 268
Code:
if (count($rv) > 0)
to
Code:
if (count($r) > 0)

(note the needed code in _not_ the same on both lines!)
« Last Edit: January 30, 2010, 18:28:53 by spearhead » Logged
Reab4

Posts: 126


View Profile
« Reply #8 on: January 30, 2010, 17:50:57 »

the log is reporting errors:
Notice on line 299 in file /usr/share/urd/functions/libs/socket.php: Undefined variable: r (8 )
Notice on line 268 in file /usr/share/urd/functions/libs/socket.php: Undefined variable: w (8 )
Logged
spearhead
Administrator
*
Posts: 1038


View Profile WWW
« Reply #9 on: January 30, 2010, 18:28:35 »

Oops I posted them the wrong way around  Huh

@ 299 --> $w
@ 268 --> $r

Sorry
Logged
Reab4

Posts: 126


View Profile
« Reply #10 on: January 30, 2010, 19:17:21 »

Yeah, now, looking at the functions,I could have seen it myself. np.

The MAKE_NZB is still on a low prio though. I mean in the queue, it is always at the bottom. Eventually it will get some attention but not before all the other tasks finish.
Ideally, the instance on generating the nzbs should be about the same as when previewing an nfo.
Logged
spearhead
Administrator
*
Posts: 1038


View Profile WWW
« Reply #11 on: January 30, 2010, 19:36:28 »

in urdd/urdd_command.php

try and change :
Code:
$response = create_make_nzb($db, $servers, $username, $priority);

into
Code:
$response = create_make_nzb($db, $servers, $username, $priority-1);

(default prio is 50, 1 highest)
Logged
Reab4

Posts: 126


View Profile
« Reply #12 on: January 30, 2010, 20:11:44 »

Yes, that seems to do the trick.
It waits for the current task to finish and then starts. That's fast enough.
Great!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Amigri by Fakdordes
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB