fix: 修复配额说明重复和undefined问题
- 在editStorageForm中初始化oss_storage_quota_value和oss_quota_unit - 删除重复的旧配额说明块,保留新的当前配额设置显示 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
87
backend/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js
generated
vendored
Normal file
87
backend/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
import http2 from "http2";
|
||||
import { NodeHttp2ConnectionPool } from "./node-http2-connection-pool";
|
||||
export class NodeHttp2ConnectionManager {
|
||||
constructor(config) {
|
||||
this.config = config;
|
||||
if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
|
||||
throw new RangeError("maxConcurrency must be greater than zero.");
|
||||
}
|
||||
}
|
||||
config;
|
||||
sessionCache = new Map();
|
||||
lease(requestContext, connectionConfiguration) {
|
||||
const url = this.getUrlString(requestContext);
|
||||
const existingPool = this.sessionCache.get(url);
|
||||
if (existingPool) {
|
||||
const existingSession = existingPool.poll();
|
||||
if (existingSession && !this.config.disableConcurrency) {
|
||||
return existingSession;
|
||||
}
|
||||
}
|
||||
const session = http2.connect(url);
|
||||
if (this.config.maxConcurrency) {
|
||||
session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
|
||||
if (err) {
|
||||
throw new Error("Fail to set maxConcurrentStreams to " +
|
||||
this.config.maxConcurrency +
|
||||
"when creating new session for " +
|
||||
requestContext.destination.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
session.unref();
|
||||
const destroySessionCb = () => {
|
||||
session.destroy();
|
||||
this.deleteSession(url, session);
|
||||
};
|
||||
session.on("goaway", destroySessionCb);
|
||||
session.on("error", destroySessionCb);
|
||||
session.on("frameError", destroySessionCb);
|
||||
session.on("close", () => this.deleteSession(url, session));
|
||||
if (connectionConfiguration.requestTimeout) {
|
||||
session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb);
|
||||
}
|
||||
const connectionPool = this.sessionCache.get(url) || new NodeHttp2ConnectionPool();
|
||||
connectionPool.offerLast(session);
|
||||
this.sessionCache.set(url, connectionPool);
|
||||
return session;
|
||||
}
|
||||
deleteSession(authority, session) {
|
||||
const existingConnectionPool = this.sessionCache.get(authority);
|
||||
if (!existingConnectionPool) {
|
||||
return;
|
||||
}
|
||||
if (!existingConnectionPool.contains(session)) {
|
||||
return;
|
||||
}
|
||||
existingConnectionPool.remove(session);
|
||||
this.sessionCache.set(authority, existingConnectionPool);
|
||||
}
|
||||
release(requestContext, session) {
|
||||
const cacheKey = this.getUrlString(requestContext);
|
||||
this.sessionCache.get(cacheKey)?.offerLast(session);
|
||||
}
|
||||
destroy() {
|
||||
for (const [key, connectionPool] of this.sessionCache) {
|
||||
for (const session of connectionPool) {
|
||||
if (!session.destroyed) {
|
||||
session.destroy();
|
||||
}
|
||||
connectionPool.remove(session);
|
||||
}
|
||||
this.sessionCache.delete(key);
|
||||
}
|
||||
}
|
||||
setMaxConcurrentStreams(maxConcurrentStreams) {
|
||||
if (maxConcurrentStreams && maxConcurrentStreams <= 0) {
|
||||
throw new RangeError("maxConcurrentStreams must be greater than zero.");
|
||||
}
|
||||
this.config.maxConcurrency = maxConcurrentStreams;
|
||||
}
|
||||
setDisableConcurrentStreams(disableConcurrentStreams) {
|
||||
this.config.disableConcurrency = disableConcurrentStreams;
|
||||
}
|
||||
getUrlString(request) {
|
||||
return request.destination.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user