On Mar 18, 8:02 am, "Jan Svitok" <jan.svi... / gmail.com> wrote:
> On 3/17/07, planetthoughtful <planetthought... / gmail.com> wrote:
>
> > I've tried looking for a timeout setting for the gmailer class, but
> > nothing leaps out at me from the associated readme file.
>
> This message is from Net::HTTP class, and IIRC it's a hardcoded
> timeout. (But you may check that somewhere near line 132 in
> C:/ruby/lib/ruby/1.8/net/protocol.rb in method `rbuf_fill', as the
> error message says (skip the timeout lines, you want to see who called
> the timeout)

Okay, looking at protocol.rb, on line 52 appears the following
"@read_timeout = 60", which is later referenced on line 132
"timeout(@read_timeout) {". So, can I just change this value on line
52 to a larger value?

> > For some reason, when I use the each_msg method to iterate through
> > unread messages, the messages get marked as read. So as it stands
> > right now, I'm explicitly setting the messages back to being unread
> > (which is probably adding to the execution time of the script), but
>
> to check how much time the 'unreading' really adds, you can use the
> benchmark library - run once with unreading and once without and
> compare.
>
> to see where the most of the time is spent, use ruby-prof (search the
> archive and/or web for a 3 part article how to use it)

Thanks for the suggestion - I'll check it out!

> > I'm wondering if there's a way to iterate through all the unread
> > messages in your inbox and retrieve, for example, the sender's email
> > address and the subject line without marking the message as having
> > been read?
>
> This I don't know.
>
> I'm wondering if POP3 access would not be faster, as it skips the html
> parsing completely, and for your needs it should be sufficient (see
> net/pop3, aka Net::POP3)

On one level POP3 might have been a good idea, but the helpful thing
about the gmailer class is that I can use it to just access, for
example, the email messages that are unread and also in my inbox. This
is, in fact, what I'm trying to build - a script that tells me if an
account needs some attention in its inbox.

Whereas, with the POP3 method, I'd have to get every message, and at
least one of these accounts has hundreds, if not thousands of messages
in it.

Thank you for your help and suggestions!

Much warmth,

pt