| 350 | | if (QueueUrl.update_all('host_id='+host.id.to_s,'id IN ('+urls.map(&:id).join(',')+') AND (host_id=0)') != urls.length) |
|---|
| 351 | | urls = [] |
|---|
| 352 | | logger.warn "get_new_queue_urls(): collision detected - rolling back" |
|---|
| 353 | | raise ActiveRecord::Rollback |
|---|
| | 350 | num_urls_updated = QueueUrl.update_all('host_id='+host.id.to_s,'id IN ('+urls.map(&:id).join(',')+') AND (host_id=0)') |
|---|
| | 351 | if (num_urls_updated != urls.length) |
|---|
| | 352 | # TODO: Clean this up. |
|---|
| | 353 | #urls = [] |
|---|
| | 354 | #logger.warn "get_new_queue_urls(): collision detected - rolling back" |
|---|
| | 355 | num_overlap = urls.length - num_urls_updated |
|---|
| | 356 | logger.warn "get_new_queue_urls(): Overlap detected - (" + num_overlap.to_s + ") URLs already assigned." |
|---|
| | 357 | # Okay, there's overlap, so only return the set of URLs that we successfully updated. |
|---|
| | 358 | urls = QueueUrl.find(:all, |
|---|
| | 359 | :conditions => {:host_id => host.id, :id => urls.map(&:id)}) |
|---|
| | 360 | # TODO: Clean this up. |
|---|
| | 361 | #raise ActiveRecord::Rollback |
|---|