Correct logic to prevent duplicate queuing of jobs during discover due to previous change in admin table
This commit is contained in:
		| @@ -11,6 +11,8 @@ | ||||
|   [BUG FIXES] | ||||
|  | ||||
|   * Respect macsuck_bleed on broken topology detection | ||||
|   * Correct logic to prevent duplicate queuing of jobs during discover due | ||||
|     to previous change in admin table | ||||
|  | ||||
| 2.020001 - 2013-12-08 | ||||
|  | ||||
|   | ||||
| @@ -848,14 +848,21 @@ sub discover_new_neighbors { | ||||
|           next; | ||||
|       } | ||||
|  | ||||
|       # could fail if queued job already exists | ||||
|       try { | ||||
|           schema('netdisco')->resultset('Admin')->create({ | ||||
|               device => $ip, | ||||
|       # Don't queued if job already exists | ||||
|       my $is_queued = schema('netdisco')->resultset('Admin')->search( | ||||
|           {   device => $ip, | ||||
|               action => 'discover', | ||||
|               status => 'queued', | ||||
|           }); | ||||
|       }; | ||||
|               status => { -like => 'queued%' }, | ||||
|           } | ||||
|       )->single; | ||||
|       unless ($is_queued) { | ||||
|           schema('netdisco')->resultset('Admin')->create( | ||||
|               {   device => $ip, | ||||
|                   action => 'discover', | ||||
|                   status => 'queued', | ||||
|               } | ||||
|           ); | ||||
|       } | ||||
|   } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user