Airblader commented on a change in pull request #16166:
URL: https://github.com/apache/flink/pull/16166#discussion_r651856074



##########
File path: 
flink-runtime-web/web-dashboard/src/app/services/logs-bundler.service.ts
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { EMPTY } from 'rxjs';
+import { catchError } from 'rxjs/operators';
+import { BASE_URL } from '../app.config';
+import {LogsBundlerStatus} from "../interfaces/logs-bundler";
+
+@Injectable({
+    providedIn: 'root'
+})
+export class LogsBundlerService {
+    constructor(private httpClient: HttpClient) {}
+
+    /**
+     * trigger log bundling
+     */
+    triggerBundle() {
+        var res = 
this.httpClient.get(`${BASE_URL}/logbundler?action=trigger`).pipe(catchError(() 
=> {
+            return EMPTY
+        }));
+        // TODO this seems to be needed to trigger the call?
+        res.toPromise().then(() => {
+            console.log("fulfilled")
+        })
+        return res;

Review comment:
       I'll take a look at the rest, but to answer the question quickly:
   
   ```
   this.http.get(...).subscribe();
   ```
   
   Observables are lazy, you need to subscribe to them for it to fire. The 
toPromise hack worked because promises are eager and thus the conversion 
triggers it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to