Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite/Rework of Sync_Links and Delete_Orphan_Links #293

Merged
merged 60 commits into from
Nov 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7173c3a
Insteon_Data3: Change Default Data3 value for I2CS devices
krkeegan Jul 31, 2013
8243c11
Insteon: Check if Code Can do Engine_Version Before Calling It
krkeegan Oct 1, 2013
6c8cc5e
Insteon: Add Subaddress to PLM ALDB Linkkey
krkeegan Oct 17, 2013
9c2177d
Insteon: Add Subaddress to PLM Linkkey When Restoring ALDB on Restart
krkeegan Oct 17, 2013
ddaa948
Insteon: PLM Delete_Orphans: Responder Data3 on Device is Responder B…
krkeegan Oct 17, 2013
37b7f30
Insteon: Cleanup Coding Errors and Debug Log Lines
krkeegan Oct 17, 2013
01dc1c8
Insteon: Initial Rewrite of Delete Orphans
krkeegan Oct 17, 2013
2b356d6
Insteon: Complete Rewrite of Delete_Orphans in AllLinkDatabase
krkeegan Oct 17, 2013
9da3e5c
Merge branch 'fix_issue_279' into insteon_data3_controller
krkeegan Oct 17, 2013
a419860
Insteon: Fix Bugs, Typos, Enable Backwards Compatability with Old Data3
krkeegan Oct 17, 2013
1de0a6e
Insteon: Condense Insteon_PLM Delete_Orphans in AllLinkDatabase
krkeegan Oct 18, 2013
796d334
Merge branch 'master' into insteon_data3_controller
krkeegan Oct 18, 2013
4746797
Insteon: Rewrite of Sync_Links to Make it More Readable
krkeegan Oct 18, 2013
f3e5dea
Insteon: Fix Typos and Bugs in New Sync_Links
krkeegan Oct 18, 2013
dd5948b
Merge branch 'master' into insteon_data3_controller
krkeegan Oct 18, 2013
8e89d2a
Merge branch 'insteon_data3' into insteon_data3_controller
krkeegan Oct 18, 2013
12fefac
Insteon: Add Function to Calculate ALDB Key
krkeegan Oct 18, 2013
c60ef18
Insteon: Move _aldb to BaseObject, Define get_root for InterfaceContr…
krkeegan Oct 18, 2013
5c8fd38
Insteon: Only Change Data3 on Responders, Don't Do Processing in _wri…
krkeegan Oct 18, 2013
7b32a9d
Insteon: Remove Old Style Data3 Code from Delete_Orphans
krkeegan Oct 18, 2013
f4a01b3
Insteon: Dont Use Data3 in PLM Linkkey
krkeegan Oct 19, 2013
d74e4d2
Insteon: Fix Comments in Link to Interface to be more clear
krkeegan Oct 19, 2013
ee2f774
Insteon: ALDB Cache is in the Member Root
krkeegan Oct 19, 2013
949f785
Insteon: Fix Logic In Sync Links
krkeegan Oct 19, 2013
a338862
Insteon: Revise Delete_Orphans Rewrite
krkeegan Oct 19, 2013
3ffbd1a
Insteon: Revise Default Data3 Distinction for i2CS/not-i2CS
krkeegan Oct 19, 2013
96689bb
Insteon: Add Comments re Oddity in PLM Control Codes
krkeegan Oct 19, 2013
7e123b5
Insteon: Sync Half Links for Deaf or Unhealthy Devices
krkeegan Oct 19, 2013
0b4f76d
Insteon: Simplify Process Delete Queue in PLM
krkeegan Oct 19, 2013
ea8b40f
Insteon: Make PLM Log Links Output Easier to Read
krkeegan Oct 19, 2013
7902e57
Insteon: Place Skip Messages into Delete_Req
krkeegan Oct 20, 2013
682114a
Merge branch 'master' into insteon_data3_controller
krkeegan Oct 20, 2013
95252ce
Merge branch 'master' into insteon_data3_controller
krkeegan Oct 20, 2013
2c33dfd
Merge branch 'master' into insteon_data3_controller
krkeegan Oct 20, 2013
038387d
Insteon: Fix Merge Conflict Bug
krkeegan Oct 20, 2013
242f989
Insteon: Don't Try and Name Unknown Objects in Delete Orphans
krkeegan Oct 20, 2013
cbec54a
Merge branch 'insteon_device_parameters' into insteon_link_redux
krkeegan Oct 20, 2013
9cebf7d
Insteon: Remove Extra ISA Calls from Sync Links
krkeegan Oct 20, 2013
944d51a
Merge branch 'insteon_device_parameters' into insteon_link_redux
krkeegan Oct 20, 2013
de7ea01
Merge branch 'insteon_set_redux' into insteon_link_redux
krkeegan Oct 20, 2013
1e6d291
Insteon: Insert Delete_Req Hash Into Itself so as not to Delete Callback
krkeegan Oct 20, 2013
ce6d858
Insteon: Add Inline Debug Msg When Skipping a Link Due to ALDB Health…
krkeegan Oct 20, 2013
3861dce
Insteon: Capture Number of Delete PLM Links
krkeegan Oct 20, 2013
e89b547
Insteon: Fix Log Link Entry for New Data3 Setup
krkeegan Oct 20, 2013
b0d9622
Insteon: Remove Unnecessary ISA Calls in Delete_Orphans
krkeegan Oct 23, 2013
a57834e
Insteon: Catch, Report and Recover from Errors in Sync All Links
krkeegan Oct 23, 2013
5ade47a
Insteon: Remove Unnecessary SubAddress Variable from Sync Links Routine
krkeegan Oct 23, 2013
b3bd3ad
Insteon: Extend Failure Callback to Update_Links
krkeegan Oct 23, 2013
e361a69
Insteon: Track, Recover, and Report from Failed Delete Orphans
krkeegan Oct 23, 2013
7907f24
Merge branch 'insteon_set_redux' into insteon_link_redux
krkeegan Oct 24, 2013
a474501
Merge branch 'master' into insteon_link_redux
krkeegan Oct 26, 2013
097d463
Insteon: Set Failure Callback for ALDB Query
krkeegan Oct 27, 2013
69d4249
Merge branch 'master' into insteon_link_redux
krkeegan Nov 6, 2013
5c1382a
Merge branch 'master' into insteon_link_redux
krkeegan Nov 6, 2013
d79e8df
Merge branch 'master' into insteon_link_redux
krkeegan Nov 14, 2013
fd47e54
Insteon: Clear Active Message Before Calling Retry Failure Callback
krkeegan Nov 15, 2013
694aa8f
Insteon: Report Skipped Devices in List of Failed Objects
krkeegan Nov 15, 2013
d27ec93
Insteon: Resume Sync Queue After Failure of a Device
krkeegan Nov 15, 2013
d1a3ec8
Insteon: Report Out-of-Sync Devices in Failed Delete Orphans Log
krkeegan Nov 15, 2013
ec6cda4
Insteon: Make Failed Device Reports Easier to Read
krkeegan Nov 15, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 34 additions & 42 deletions lib/Insteon.pm
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ sub _get_next_linkscan
## check if aldb_delta has changed;
$current_scan_device->_aldb->{_aldb_unchanged_callback} = '&Insteon::_get_next_linkscan('.$skip_unchanged.')';
$current_scan_device->_aldb->{_aldb_changed_callback} = '&Insteon::_get_next_linkscan('.$skip_unchanged.', '.$current_scan_device->get_object_name.')';
$current_scan_device->_aldb->{_failure_callback} = '&Insteon::_get_next_linkscan_failure('.$skip_unchanged.')';
$current_scan_device->_aldb->query_aldb_delta("check");
$checking = 1;
}
Expand All @@ -476,16 +477,14 @@ sub _get_next_linkscan
{
&main::print_log("[Scan all link tables] All tables have completed scanning");
my $_scan_failure_cnt = scalar @_scan_device_failures;
if ($_scan_failure_cnt)
{
&main::print_log("[Scan all link tables] However, some failures were noted:");
for my $failed_obj (@_scan_device_failures)
{
&main::print_log("[Scan all link tables] WARN: failure occurred when scanning "
. $failed_obj->get_object_name);
}
}

if ($_scan_failure_cnt){
my $obj_list;
for my $failed_obj (@_scan_device_failures){
$obj_list .= $failed_obj->get_object_name .", ";
}
::print_log("[Scan all link tables] However, some failures "
."were noted with the following devices: $obj_list");
}
}
}

Expand All @@ -510,22 +509,10 @@ sub sync_all_links
# iterate over all registered objects and compare whether the link tables match defined scene linkages in known Insteon_Links
for my $obj (&Insteon::find_members('Insteon::BaseController'))
{
if (!$obj->isa('Insteon::InterfaceController') && $obj->is_deaf)
{
&main::print_log("[Sync all links] Ignoring links from 'deaf' device: " . $obj->get_object_name);
}
elsif(!($obj->isa('Insteon::InterfaceController')) && ($obj->_aldb->health eq 'unknown'))
{
&main::print_log("[Sync all links] Skipping links from 'unreachable' device: "
. $obj->get_object_name . ". Consider rescanning the link table of this device");
}
else
{
my %sync_req = ('sync_object' => $obj, 'audit_mode' => ($audit_mode) ? 1 : 0);
&main::print_log("[Sync all links] Adding " . $obj->get_object_name
. " to sync queue");
push @_sync_devices, \%sync_req
};
my %sync_req = ('sync_object' => $obj, 'audit_mode' => ($audit_mode) ? 1 : 0);
&main::print_log("[Sync all links] Adding " . $obj->get_object_name
. " to sync queue");
push @_sync_devices, \%sync_req
}

$_sync_cnt = scalar @_sync_devices;
Expand Down Expand Up @@ -570,16 +557,14 @@ sub _get_next_linksync
{
&main::print_log("[Sync all links] All links have completed syncing");
my $_sync_failure_cnt = scalar @_sync_device_failures;
if ($_sync_failure_cnt)
{
&main::print_log("[Sync all links] However, some failures were noted:");
for my $failed_obj (@_sync_device_failures)
{
&main::print_log("[Sync all links] WARN: failure occurred when syncing "
. $failed_obj->get_object_name);
}
}

if ($_sync_failure_cnt){
my $obj_list;
for my $failed_obj (@_sync_device_failures){
$obj_list .= $failed_obj->get_object_name .", ";
}
::print_log("[Sync all links] WARN! Failures occured, "
."some links involving the following objects remain out-of-sync: $obj_list");
}
}

}
Expand All @@ -593,10 +578,17 @@ the failed device to the module global variable @_sync_device_failures.

sub _get_next_linksync_failure
{
push @_sync_device_failures, $current_sync_device;
&main::print_log("[Sync all links] WARN: failure occurred when scanning "
. $current_sync_device->get_object_name . ". Moving on...");
&_get_next_linksync();
push @_sync_device_failures, $current_sync_device
unless (grep{$current_sync_device == $_} @_sync_device_failures);
&main::print_log("[Sync all links] WARN: failure occurred when syncing links for "
. $current_sync_device->get_object_name . ". Resuming sync queue if it exists.");
my $num_sync_queue = @{$$current_sync_device{sync_queue}};
if ($num_sync_queue){
$current_sync_device->_process_sync_queue();
}
else { #No other pending links in the queue
&_get_next_linksync();
}

}

Expand Down Expand Up @@ -905,7 +897,7 @@ sub init {
@_insteon_link = ();

}

=item C<generate_voice_commands()>

Generates and sets the voice commands for all Insteon devices.
Expand Down Expand Up @@ -1197,7 +1189,7 @@ sub _active_interface
$$self{active_interface} = $interface if $interface;
return $$self{active_interface};
}

=item C<add()>

Adds a list of objects to be tracked.
Expand Down
Loading