Lock device_port table when updating Device Ports (closes #40)

This commit is contained in:
Oliver Gorwits
2013-10-19 19:57:52 +01:00
parent 11b054f1a9
commit a03f9cb865
3 changed files with 6 additions and 1 deletions

View File

@@ -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;

View File

@@ -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