我目前在GKE(k8s 1.2)上配置了Ingress,以便将请求转发到我的应用程序的pod.我有一个请求,可能需要很长时间(30秒)和我的应用程序超时(504).我观察到,当我这样做时,我收到的响应不是我自己的504,而是60秒后看起来像Google Loadbalancer的502 .
我玩了不同的状态代码和持续时间,正好在30秒后我开始接收这种奇怪的行为,无论发出的状态代码如何.
任何人都知道如何解决这个问题?有没有办法重新配置这种行为?
我一直在尝试使用Angular 2来使用可拖动的div工作.我使用angular2-examples repo中的这个示例作为起点,只是真正调整代码来解释toRx()方法的删除.代码有效,但它不考虑mouseout事件.这意味着如果我单击一个Draggable div,然后慢慢移动鼠标,div将随鼠标移动.但是如果我移动鼠标的速度太快,mouseout则会发送一个mousemove事件而不是一个事件,拖动停止.
在鼠标移动到目前为止mouseout触发事件后,如何保持拖动?我已经尝试将mouseout事件流与mousemove一个事件流合并,以便将mouseout事件视为一个事件mousemove,但这不起作用.
我正在使用Angular 2.0.0-beta.12.
import {Component, Directive, HostListener, EventEmitter, ElementRef, OnInit} from 'angular2/core';
import {map, merge} from 'rxjs/Rx';
@Directive({
selector: '[draggable]'
})
export class Draggable implements OnInit {
mouseup = new EventEmitter();
mousedown = new EventEmitter();
mousemove = new EventEmitter();
mouseout = new EventEmitter();
@HostListener('mouseup', ['$event'])
onMouseup(event) {
this.mouseup.emit(event);
}
@HostListener('mousedown', ['$event'])
onMousedown(event) …Run Code Online (Sandbox Code Playgroud) 最近,我决定将使用Angular的"快速入门"从头开始创建的大项目迁移到使用Angular CLI 1.5.5的版本.现在,我正在解决出现的各种问题,我无法解决这个问题.
我读到最好使用rxjs的lettable操作符,我做了它并且它工作得很好.但是,我也有这些代码行:
import { Observable } from "rxjs/Observable";
import "rxjs/add/observable/forkjoin";
...
let piecesGrouping$: Observable<IGroupedPiece[]>[] = deliveries.map(delivery => this._pieceService.getGroupedPieces(delivery.pieces));
Observable
.forkJoin(...piecesGrouping$)
.subscribe((groups) => {
groups.forEach((group, i) => deliveries[i].groupedPieces = group);
resolve();
});
Run Code Online (Sandbox Code Playgroud)
他们在之前使用rxjs 5.4.3的版本中工作得很好,现在使用rxjs 5.5.2,他们不再使用了,我得到以下错误:
错误:未捕获(在承诺中):TypeError:无法读取未定义的属性'apply'TypeError:无法读取未定义的属性'apply'
我试图替换传播操作符,piecesGrouping$[0], piecesGrouping$[1]因为错误本身没有说什么forkJoin,然后我得到:
错误:未捕获(在承诺中):TypeError: WEBPACK_IMPORTED_MODULE_8_rxjs_Observable .a.forkJoin不是函数TypeError: WEBPACK_IMPORTED_MODULE_8_rxjs_Observable .a.forkJoin不是函数
所以看起来我输入forkJoin错误的方式.我试图从"rxjs/observable/forkJoin"导入它,但它也没有用.
我错过了什么?
在我的Angular 2应用程序中,我需要发出一系列的http请求.我有两个服务,A和B,每个服务都发出请求,A.get()并B.get()从API获取数据并将它们存储在他们的服务中.这两者可以在同一时间被调用,但是我的第三个请求,doSomething()这取决于结果A.get()和B.get().由于两个A.get()和B.get()正在存储他们的反应当地的返回值,最终成为RxJs认购.像这样:
class A{
public data;
public get(){
return api.call(params).subscribe((response)=>{ this.data = response.json();})
}
}
class B{
public data;
public get(){
return api.call(params).subscribe((response)=>{ this.data = response.json();})
}
}
Run Code Online (Sandbox Code Playgroud)
我的组件看起来像这样:
class MyComponent{
constructor(private a: A, private b: B){
a.get();
b.get();
this.doSomething(a.data, b.data);
}
doSomething(aData, bData){
...
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是doSomething()失败,因为a.get()并b.get()完成了http请求.我需要一种方法来控制呼叫,doSomething()直到我的其他呼叫完成.我一直在搜索但是没有运气这个问题.RxJs文档提供了一些可以合并的方法,Observables但这不是我在这种情况下的方法.
是否有可在Google App Engine上运行的持续集成工具?
我正在尝试使用Firebase FireStore数据库在Angular 2中构建一个聊天应用程序.
我能够创建一个Collection,Docuement每个'消息' 都有一个.我使用此代码来检索消息:
export interface MessageItem {
message: string;
DateTime: Date;
User: string;
}
messagesCollection: AngularFirestoreCollection<MessageItem>;
messages: Observable<MessageItem[]>;
getChatData() {
this.messagesCollection = this.afs.collection<MessageItem>('chat_messages');
this.messages = this.messagesCollection.valueChanges();
}
Run Code Online (Sandbox Code Playgroud)
但是,因为我想要多个用户,所以我想Document为每个用户创建一个用户,这些用户存储在一个Collection消息中.
这使它变得复杂,我不确定如何完成它.
我很乐意提供一些指导.
对于我当前的项目,我宁愿在发布时将我的数据库更新为正确的版本,而不是首先通过App_Start运行.
似乎通过与Entity Framework(5.0 rc2)一起提供的命令行工具'migrate.exe'支持手动升级.但我找不到任何有关其他人如何将此工具与msdeploy结合使用以在发布而不是首次运行时升级数据库的任何信息.
我找到了以下页面,其中介绍了如何使用migrate.exe工具:http: //blog.overridethis.com/blog/post/2012/03/13/Automating-EF-43x═-Migrations-in-your -Build.aspx
但这迫使我以某种方式'知道'连接字符串信息.
我的最佳解决方案是:
我搜索的似乎是'实体框架MSDeploy提供者'(参见:http://blogs.msdn.com/b/adonet/archive/2012/01/12/ef-4-3-beta-1- release.aspx)但似乎他们不久前放弃了这个选项
我对"dispose"或"unsubscribe"函数的用途是什么感到困惑,它(可选)从一个可观察的"executor"函数返回,如下所示:
const Rx = require('rxjs');
const obs = Rx.Observable.create(obs => {
// we are in the Observable "executor" function
obs.next(4);
// we return this function, which gets called if we unsubscribe
return function () {
console.log('disposed');
}
});
const s1 = obs.subscribe(
function (v) {
console.log(v);
},
function (e) {
console.log(e);
},
function () {
console.log('complete');
}
);
const s2 = obs.subscribe(
function (v) {
console.log(v);
},
function (e) {
console.log(e);
},
function () {
console.log('complete');
}
);
s1.unsubscribe();
s2.unsubscribe(); …Run Code Online (Sandbox Code Playgroud) 我有一个像下面这样的异步方法.它[ts] 'await' expression is only allowed within an async function.在这里显示错误await userProfile.set({.你能告诉我怎么解决它吗?
注意:也许是因为我试图在promise里面打电话observable.任何线索?
async loginWithGoogle(): Promise<void> {
const result = await this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
const userId: string = result.uid;
const userProfile: AngularFirestoreDocument<UserProfile> = this.fireStore.doc(`userProfile/${userId}`);
const userProfiles: AngularFirestoreCollection<UserProfile> = this.fireStore.collection('userProfile/', ref => ref.where('email', '==', result.email));
const userProfiles$: Observable<UserProfile[]> = userProfiles.valueChanges();
userProfiles$.subscribe(res => {
if (res == null) {
await userProfile.set({ //here it shows error
id: userId,
email: result.email,
creationTime: moment().format(),
lastSignInTime: moment().format()
});
} …Run Code Online (Sandbox Code Playgroud) 我正在搜索索引中的文档,然后尝试通过它来获取其中的一些文档_id.尽管收到了一组结果,但一些文档无法通过简单的get获取.更糟糕的是,我可以通过URI搜索获得相同的文档?_id:<the id>
例如,运行一个简单的GET
curl -XGET 'http://localhost:9200/keepbusy_process__issuer_application/KeepBusy__Activities__Activity/neHSKSBCSv-OyAYn3IFcew'
Run Code Online (Sandbox Code Playgroud)
给我结果:
{
"_index" : "keepbusy_process__issuer_application",
"_type" : "KeepBusy__Activities__Activity",
"_id" : "neHSKSBCSv-OyAYn3IFcew",
"exists" : false
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我使用相同的_id进行搜索:
curl -XGET 'http://localhost:9200/keepbusy_process__issuer_application/KeepBusy__Activities__Activity/_search?q=_id:neHSKSBCSv-OyAYn3IFcew'
Run Code Online (Sandbox Code Playgroud)
我得到了预期的结果:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1.0,
"hits": [
{
"_index": "keepbusy_process__issuer_application",
"_type": "KeepBusy__Activities__Activity",
"_id": "neHSKSBCSv-OyAYn3IFcew",
"_score": 1.0,
"_source": {
"template_uid": "KeepBusy__Activities__Activity.create application",
"name": "create application",
"updated_at": "2014-01-08T10:02:33-05:00",
"updated_at_ms": 1389193353975
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
我正在通过担架ruby API索引文档,并在索引后立即进行刷新.我的本地设置是2个节点 …
angular ×5
rxjs ×3
rxjs5 ×2
angular-cli ×1
angularfire2 ×1
deployment ×1
firebase ×1
ionic3 ×1
javascript ×1
kubernetes ×1
msdeploy ×1
observable ×1