摘要: 最近复盘一段线上偶发 401 的问题,根因很有代表性:一个 AWS Lambda 把下游服务的 access token 缓存在模块级变量里,但缓存时既不记过期时间、也不在复用前检查过期。在 AWS Lambda 复用执行环境(暖启动) 的执行模型下,这会导致同一个执行环境一直复用一份早就过期的 t 阅读全文
posted @ 2026-06-09 21:58 Laggage 阅读(16) 评论(0) 推荐(0)
摘要: 1. 背景与现象 在日常维护一个运行了接近 4 年的 Kubernetes 高可用集群(v1.26.1)时,收到了业务报错:新部署的某个 Deployment(docker-registry)一直处于 Pending 状态,且没有任何 Pod 生成。 常规排查三板斧(Deployment -> Re 阅读全文
posted @ 2026-05-26 23:27 Laggage 阅读(27) 评论(0) 推荐(0)
摘要: kubernetes 集群中某些 pod 启动失败, 报错  'failed to reserve container name' 问题环境: 系统: Ubuntu 22.04.1 LTS 使用 kubeadm 初始化的 kubernetes 集群 容器运行时: containerd containerd 版本: containerd containerd.io 1.6.22 8165feabfdfe38c65b599c4993 阅读全文
posted @ 2025-02-09 21:55 Laggage 阅读(339) 评论(1) 推荐(1)
该文被密码保护。 阅读全文
posted @ 2024-12-19 13:50 Laggage 阅读(4) 评论(0) 推荐(0)
摘要: 在脚本中,有时希望在sed命令中使用shell定义的变量。在此时,就要用双引号而不是单引号来引用sed命令,因为对shell来说,它会处理双引号中的变量引用,而对单引号中的内容,shell完全不会动。例如: export TERM1=term; export TERM2=rxvt; echo "te 阅读全文
posted @ 2024-06-25 09:04 Laggage 阅读(190) 评论(0) 推荐(0)
摘要: const reg = /^[0-9]+/g reg.test('123') // expect true actual true reg.test('123') // expect true actual false reg.test('123') // expect true actual tr 阅读全文
posted @ 2023-12-28 15:48 Laggage 阅读(58) 评论(0) 推荐(0)
摘要: 值类型和引用类型 原始类型(alias: 值类型,基础类型) primitive: string number boolean undefined symbol null 引用类型: Object 其他内置Object派送类型 Array Function Map Set WeakMap WeakS 阅读全文
posted @ 2023-04-23 23:05 Laggage 阅读(69) 评论(0) 推荐(0)
摘要: "种草" kubernetes-dashboard 安装部署dashboard 创建用于登录面板的ServiceAccount 权限控制 "种草" kubernetes-dashboard Kubernetes Dashboard 是通用的用于管理 Kubernetes 集群的 WebUI面板 ku 阅读全文
posted @ 2023-04-19 23:19 Laggage 阅读(632) 评论(0) 推荐(0)
摘要: 题目 中文 给定一个字符串数组, 实现它的全排列组合. English Given an array of strings, do Permutation & Combination. It's also useful for the prop types like video controlsLi 阅读全文
posted @ 2022-12-18 18:55 Laggage 阅读(134) 评论(0) 推荐(0)
摘要: 题目 中文 有时我们需要限制数字的范围... 示例: type result = NumberRange<2 , 9> // | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 English Sometimes we want to limit the range of numbers 阅读全文
posted @ 2022-12-04 19:53 Laggage 阅读(174) 评论(0) 推荐(0)
摘要: 题目 中文 构造一个给定长度的元组。 例如 type result = ConstructTuple<2> // 期望得到 [unknown, unkonwn] English Construct a tuple with a given length. For example type resul 阅读全文
posted @ 2022-12-04 19:50 Laggage 阅读(76) 评论(0) 推荐(0)
摘要: 题目 中文 实现 MapTypes<T, R>, 它将对象 T 中的类型转换为有如下结构的类型 R 定义的类型 type StringToNumber = { mapFrom: string; // 类型为 string 的键(key) mapTo: number; // 会被转换为 number 阅读全文
posted @ 2022-11-14 21:27 Laggage 阅读(215) 评论(0) 推荐(0)
摘要: 题目 中文 实现类型的 Lodash.uniq, Unique 接受数组 T, 返回没有重复值的数组 T English Implement the type version of Lodash.uniq, Unique takes an Array T, returns the Array T w 阅读全文
posted @ 2022-11-12 03:03 Laggage 阅读(201) 评论(0) 推荐(0)
摘要: 题目 中文 实现类型的 Array.lastIndexOf, LastIndexOf<T, U> 接受泛型参数 Array T 和 any U 并返回数组 T 中最后一个 U 的索引 示例: type Res1 = LastIndexOf<[1, 2, 3, 2, 1], 2>; // 3 type 阅读全文
posted @ 2022-11-12 01:43 Laggage 阅读(126) 评论(0) 推荐(0)
摘要: 题目 中文 实现类型版本的 Array.join, Join<T, U> 接受数组 T 和 string 或者 number 类型 U 作为泛型参数, 并返回 U 连接数组 T 后的字符串. English Implement the type version of Array.join, Join 阅读全文
posted @ 2022-11-08 01:41 Laggage 阅读(182) 评论(0) 推荐(0)
摘要: 题目 中文 实现类型版本的 Array.indexOf, indexOf<T, U> 接受一个数组T和any类型的U作为参数, 返回T中第一个U的索引 type Res = IndexOf<[1, 2, 3], 2>; // expected to be 1 type Res1 = IndexOf< 阅读全文
posted @ 2022-10-25 01:43 Laggage 阅读(92) 评论(0) 推荐(0)
摘要: 题目 中文 实现类型版本的 Math.trunc, 其接受一个字符串或数字作为泛型参数, 并返回移除了全部小数位部分后的整数 示例: type A = Trunc<12.34>; // 12 English Implement the type version of Math.trunc, whic 阅读全文
posted @ 2022-10-24 23:12 Laggage 阅读(67) 评论(0) 推荐(0)
摘要: 题目 中文 实现一个像 Lodash.without 函数一样的泛型 Without<T, U>,它接收数组类型的 T 和数字或数组类型的 U 为参数,会返回一个去除 U 中元素的数组 T。 例如: type Res = Without<[1, 2], 1>; // expected to be [ 阅读全文
posted @ 2022-10-24 23:05 Laggage 阅读(101) 评论(0) 推荐(0)
摘要: 题目 中文 实现 TrimRight<T> ,它接收确定的字符串类型并返回一个新的字符串,其中新返回的字符串删除了原字符串结尾的空白字符串。 例如 type Trimed = TrimRight<' Hello World '>; // 应推导出 ' Hello World' English Imp 阅读全文
posted @ 2022-10-24 22:41 Laggage 阅读(80) 评论(0) 推荐(0)
摘要: 题目 中文 Fill是 javascript 中常用的方法, 现在让我实现类型版本的 Fill Fill<T, N, Start?, End?>, 正如你看到的那样, Fill接受四个泛型参数, 其中 T 和 N 是必填参数, Start 和 End 是可选参数 这些参数的要求如下: T 必须是一个 阅读全文
posted @ 2022-10-24 00:28 Laggage 阅读(91) 评论(0) 推荐(0)
摘要: 题目 中文 你知道 lodash 吗? lodash中有一个非常实用的方法Chunk, 让我们实现它吧. Chunk<T, N>接受两个泛型参数, 其中 T 是 tuple 类型, N是大于 1 的数字 type exp1 = Chunk<[1, 2, 3], 2>; // expected to 阅读全文
posted @ 2022-10-23 22:43 Laggage 阅读(95) 评论(0) 推荐(0)
摘要: 题目 中文 实现 IsTuple 类型, 接受一个泛型参数 T 作为输入, 并返回 T 是否为 tuple 类型 示例: type case1 = IsTuple<[number]>; // true type case2 = IsTuple<readonly [number]>; // true 阅读全文
posted @ 2022-10-23 21:58 Laggage 阅读(88) 评论(0) 推荐(0)
摘要: 题目 中文 在本挑战中, 你需要实现 GreaterThan<T, U>, 它的作用像 T > U 你不需要考虑负数 示例: GreaterThan < 2, 1 > //should be true GreaterThan < 1, 1 > //should be false GreaterTha 阅读全文
posted @ 2022-10-23 20:58 Laggage 阅读(89) 评论(0) 推荐(0)
摘要: 题目 中文 实现类型 AllCombinations<S>,该类型返回字符串 S 中字符的所有排列组合。 English Implement type AllCombinations<S> that return all combinations of strings which use chara 阅读全文
posted @ 2022-10-23 20:21 Laggage 阅读(91) 评论(0) 推荐(0)
摘要: 题目 中文 实现类型版本的 Array.shift English Implement the type version of Array.shift For example type Result = Shift<[3, 2, 1]>; // [2, 1] 答案 type Shift<T exte 阅读全文
posted @ 2022-10-18 21:42 Laggage 阅读(125) 评论(0) 推荐(0)