You are hereForums / Support / Query videocache queue?

Query videocache queue?


1 reply [Last post]
Offline
Joined: Feb 15 2009
Query videocache queue?
Printer-friendly versionSend to friend

Is there a way to get a list or a count of how many downloads videocache has in queue? I'm working on restricting how much bandwidth videocache consumes for cache object fetches. Being able to see how large the queue gets for different bandwidth restrictions would be useful.

Offline
Joined: Jun 19 2009

Here's a patch to add a very simple method to videocache's XML-RPC server to report the size of the queue. Save it into a file called queue_size.patch in the untarred videocache directory, then run patch -p0 < queue_size.patch.

--- videocache/videocache.py
+++ videocache/videocache.py
@@ -174,6 +174,9 @@ class VideoIDPool:
             return self.queue[video_id]
         return False
 
+    def get_queue_size(self)
+        return len(self.queue)
+
     def remove_from_queue(self, video_id):
         """Dequeue a video_id from the download queue."""
         if video_id in self.queue.keys():

And here's a shell script to query the XML-RPC server and return the queue size. This works fine on a default install of FreeBSD 7.2. Your results may vary.

#!/bin/sh
# get videocache queue size
VCACHE='videocache.domain.tld'
 
tmp=`mktemp -t vc`  #|| exit 1
echo "<?xml version=\"1.0\"?>
<methodCall>
    <methodName>get_queue_size</methodName>
    <params>
    </params>
</methodCall>" > $tmp
 
size=`cat $tmp | wc -c`
 
msg=`mktemp -t vc`
echo "POST / HTTP/1.1
Content-length: $size
" > $msg
 
cat $tmp >> $msg
rm $tmp
cat $msg | nc $VCACHE 9100 | sed -ne '/value/p' | grep -o '[0-9]'
rm $msg

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <code>
  • Lines and paragraphs break automatically.
  • HTML tags will be transformed to conform to HTML standards.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

CAPTCHA
Are you a human visitor ?
Image CAPTCHA
Enter the characters (without spaces) shown in the image.

Buy Now

Videocache Bundle (RPM and tar archive) is available for just $39.99. Secure your copy now by clicking the button below.
For details, check this page.

Recent comments

Spread it

Thank you for spreading the word!

Who's online

There are currently 2 users and 99 guests online.