Fix pending() sometimes returning negative values

Sometimes the load-failed and response-received signals are fired for a
single request leading to a double decremented pending counter.

Replace the simple counter by a hash of pending requests so each request
is only removed once from the list.