Provided are a method, system, and program automatic adjustment of time a
consumer waits to access data from a queue during a waiting phase and
transmission phase at the queue. A determination is made as to whether a
queue is in a waiting phase or a transmission phase for data in response
to waiting for a waiting phase wait time when initiating an operation to
access data from the queue. During the waiting phase data is not
available in the queue for reading. An incremental wait time is waited in
response to determining that the queue is in the waiting phase. A
determination is made as to whether the queue is in the waiting phase or
the transmission phase in response to waiting the incremental wait time.
A total wait time is recorded in response to determining that the queue
is in the transmission phase. The at least one recorded total wait time
is used to determine the waiting phase wait time to use when initiating
the operation to access data from the queue.