diff --git a/Netdisco/Changes b/Netdisco/Changes index e6e22bfb..c1cac867 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -10,6 +10,7 @@ * Return first port neighbor match, if multiple devices claim the IP (closes #42) * Should handle empty ports preferences (closes #39) * Decode more entPhysicalEntry columns as UTF-8 (closes #37) + * Lock device_port table when updating Device Ports (closes #40) 2.018000 - 2013-10-08 diff --git a/Netdisco/lib/App/Netdisco/Core/Discover.pm b/Netdisco/lib/App/Netdisco/Core/Discover.pm index 059653ab..364b7ede 100644 --- a/Netdisco/lib/App/Netdisco/Core/Discover.pm +++ b/Netdisco/lib/App/Netdisco/Core/Discover.pm @@ -282,7 +282,7 @@ sub store_interfaces { }; } - schema('netdisco')->txn_do(sub { + schema('netdisco')->resultset('DevicePort')->txn_do_locked(sub { my $gone = $device->ports->delete({keep_nodes => 1}); debug sprintf ' [%s] interfaces - removed %s interfaces', $device->ip, $gone; diff --git a/Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePort.pm b/Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePort.pm index 58b7ba55..29d3fa56 100644 --- a/Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePort.pm +++ b/Netdisco/lib/App/Netdisco/DB/ResultSet/DevicePort.pm @@ -4,6 +4,10 @@ use base 'DBIx::Class::ResultSet'; use strict; use warnings FATAL => 'all'; +__PACKAGE__->load_components(qw/ + +App::Netdisco::DB::ExplicitLocking +/); + =head1 ADDITIONAL METHODS =head2 with_times