Github user ruffle1986 commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1156#discussion_r208946955
  
    --- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-panel/pcap-panel.component.ts 
---
    @@ -15,22 +15,22 @@
      * See the License for the specific language governing permissions and
      * limitations under the License.
      */
    -import { Component, Input } from '@angular/core';
    +import { Component, OnInit, Input } from '@angular/core';
     
     import { PcapService } from '../service/pcap.service';
     import { PcapStatusResponse } from '../model/pcap-status-response';
     import { PcapRequest } from '../model/pcap.request';
     import { Pdml } from '../model/pdml';
     import { Subscription } from 'rxjs/Rx';
     import { PcapPagination } from '../model/pcap-pagination';
    -import {RestError} from "../../model/rest-error";
    +import { RestError } from "../../model/rest-error";
     
     @Component({
       selector: 'app-pcap-panel',
       templateUrl: './pcap-panel.component.html',
       styleUrls: ['./pcap-panel.component.scss']
     })
    -export class PcapPanelComponent {
    +export class PcapPanelComponent implements OnInit {
    --- End diff --
    
    @merrimanr You should also implement the OnDestroy interface and 
unsubscribe from all the observables in the `ngOnDestroy` method. Especially 
from the polling observable. By doing this, you can make sure that the 
component won't continue the polling for the job's status when the user 
navigates somewhere else from the pcap tab. If you unsubscribe in the 
destructor method, it'll stop the pending http requests immediately as well 
when the route changes. Not to mention freeing up the memory when the component 
is not rendered anymore.


---

Reply via email to