我一直在试图找出为什么标签失效不起作用并添加了一些日志记录。in工作正常,但providesTags
in从未被调用。可能出了什么问题?getMe
invalidatesTags
login
我有一个像这样的 redux RTK 查询 API:
const baseQuery = fetchBaseQuery({
baseUrl: baseUrl,
prepareHeaders: (headers, { getState }) => {
const token = getState().auth.token
if (token) {
headers.set('authorization', `Bearer ${token}`)
}
return headers
},
})
export const api = createApi({
baseQuery: baseQuery,
tagTypes: ['User'],
endpoints: build => ({
login: build.mutation({
query: code => ({
url: `auth/login/?code=${code}`,
method: 'POST',
}),
invalidatesTags: (result, error, arg) => {
console.log('auth/login', result, error, arg)
return ['User']
},
}),
getMe: build.query({
query: …
Run Code Online (Sandbox Code Playgroud) 如何使用 psycopg 的命名参数将列表传递给查询中的IN语句?
例子:
cur.execute("""
SELECT name
FROM users
WHERE id IN (%(ids)s)
""",
{"ids": [1, 2, 3]})
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我收到以下错误消息:
psycopg.errors.UndefinedFunction: operator does not exist: integer = smallint[]
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Run Code Online (Sandbox Code Playgroud) 我目前正在启用termination_protection
使用Ansible创建的所有实例,以防止从控制台等意外终止。现在,我希望能够使用Ansible终止特定的实例,但我不知道如何在其上禁用终止保护。
我认为这可以解决问题:
- name: Disable termination protection
ec2:
instance_ids: "{{ instance_ids }}"
region: "{{ aws_region }}"
termination_protection: no
Run Code Online (Sandbox Code Playgroud)
运行该错误消息的方式:
fatal: [localhost]: FAILED! => {
"changed": false,
"failed": true,
"msg": "image parameter is required for new instance"
}
Run Code Online (Sandbox Code Playgroud)
看起来Ansible会将我的脚本解释为实例创建请求。
有没有办法改变termination protection
另一个模块?我唯一想到的另一种方法是通过Ansible中的一项任务使用aws clishell
,但这有点麻烦。