From: vinurs <hi@vinurs.me>
To: 73310@debbugs.gnu.org
Subject: bug#73310: tree-sitter makes cpu 100%
Date: Tue, 17 Sep 2024 09:27:20 +0800 [thread overview]
Message-ID: <etPan.66e8dafd.15470223.15a2e@vinurs.me> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 814 bytes --]
Hi,
I am using the latest emacs-30 https://github.com/emacs-mirror/emacs/commit/c6077015894dd89c5aa3811bf55d3124394874d0
The min configuration is as follows:
(add-to-list 'treesit-extra-load-path (expand-file-name "tree-sitter/" user-emacs-directory))
(add-to-list 'load-path "~/.emacs.d/site-lisp/clojure-ts-mode”)
(require 'clojure-ts-mode)
;; debug
(setq debug-on-quit t)
and I only use clojure-ts-mode package
cd ~/.emacs.d/site-lisp
git clone https://github.com/clojure-emacs/clojure-ts-mode.git
Then, after opening Emacs, Open the elong.clj file,
After moving to line 52, delete all the characters following :error-code, then quickly press the spacebar twice. At this point, it freezes.
------------
Sincerely,
Haiyuan Zhang, Vinurs
BinaryBrain LLC
[-- Attachment #1.2: Type: text/html, Size: 1598 bytes --]
[-- Attachment #2: elong.clj --]
[-- Type: application/octet-stream, Size: 4847 bytes --]
(ns server.app.web.routes.hotel-sync.elong-hotel-res
(:refer-clojure :exclude [])
(:require
[clojure.tools.logging :as log]
[java-time.api :as java-time]
[server.app.web.routes.hotel-sync.auth :refer [verify-credentials]]
[server.app.web.routes.hotel-sync.elong-errors :refer [elong-cancel-errors]]
[server.app.web.routes.hotel-sync.tools :refer [generate-order-number
map->xml]]))
(defn- prepare-success-resp-data
"准备成功响应的数据"
[{:keys [root-tag-info] :as parsed-req}]
(let [{:keys [version echo-token requestor-type requestor-id]} root-tag-info
{:keys [unique-id]} parsed-req]
(log/info "hahahah" unique-id)
{;; 和RQ指令的值一致
:version version
;; 时间戳
:timestamp (java-time/format "yyyy-MM-dd HH:mm:ss" (java-time/local-date-time))
;; 版本,1.000或2.000
:echo-token echo-token
;; 请求者类型,这里固定为2,CRO(Customer Reservations Office)
:requestor-type requestor-type
;; 请求者唯一编码
:requestor-id requestor-id
;; 艺龙订单号
:elong-order-id unique-id
;; 确认单号或供应商订单号,10表示酒店确认号或供应商订单号,二选一
:supplier-order-id (generate-order-number)}))
(defn- prepare-failure-resp-data
"准备失败响应的数据"
[{:keys [root-tag-info error-code] :as parsed-req}]
(let [{:keys [version echo-token requestor-type requestor-id]} root-tag-info]
{;; 和RQ指令的值一致
:version version
;; 时间戳
:timestamp (java-time/format "yyyy-MM-dd HH:mm:ss" (java-time/local-date-time))
;; 版本,1.000或2.000
:echo-token echo-token
;; 请求者类型,这里固定为2,CRO(Customer Reservations Office)
:requestor-type requestor-type
;; 请求者唯一编码
:requestor-id requestor-id
:error-type 3
:error-code 3211
:error-content (get-in elong-cancel-errors [ 4002 :zh] ) }))
(defn- build-success-resp-map
"构造成功返回的数据结构"
[{:keys [timestamp version echo-token elong-order-id supplier-order-id
requestor-type requestor-id]}]
{:OTA_HotelResRS
{:attrs
{:TimeStamp timestamp
:Version version
:EchoToken echo-token}
:children
[{:POS
{:children
[{:Source
{:children
[{:RequestorID
{:attrs {:Type requestor-type :ID requestor-id}}}]}}]}}
{:Success {:content "success"}}
{:UniqueID
{:attrs {:Type "14" :ID elong-order-id}
:children
[{:CompanyName {:content "elong"}}]}}
{:UniqueID
{:attrs {:Type "10" :ID supplier-order-id}
:children
[{:CompanyName {:content "Jltour"}}]}}]}})
(defn- build-failure-resp-map
"构造失败返回的数据结构"
[{:keys [timestamp version echo-token error-code error-type error-content
requestor-type requestor-id]}]
{:OTA_HotelResRS
{:attrs
{:TimeStamp timestamp
:Version version
:EchoToken echo-token}
:children
[{:POS
{:children
[{:Source
{:children
[{:RequestorID
{:attrs {:Type requestor-type :ID requestor-id}}}]}}]}}
{:Errors
{:children
[{:Error
{:attrs {:Language "en-us" :Type error-type :Code error-code}
:content error-content}}]}}
{:UniqueID
{:attrs {:Type "10" :ID "0"}
:children
[{:CompanyName {:content "qmango"}}]}}]}})
(defn handle-hotel-res-rq
"处理创建订单请求,返回 xml "
[{:keys [root-tag-info] :as parsed-req}]
(let [{:keys [username password]} root-tag-info
;; 准备东呈下单需要的数据
;; dossen-check-data (prepare-dossen-check-data parsed-req)
]
(log/info "开始调用东呈下单接口")
(if-not (verify-credentials username password)
(let [resp-data (prepare-failure-resp-data parsed-req)
resp-map (build-failure-resp-map resp-data)]
(map->xml resp-map)
)
;; 用户名密码校验成功
(let [;; 根据东呈的处理结果
;; dossen-result (check-hotel-price-and-cnt dossen-check-data)
;; room-info (-> dossen-result :data first :activityResvRoomList first)
]
;; (log/info "东呈下单接口:" dossen-result)
(if true
;; 处理成功的
(let [resp-data (prepare-success-resp-data parsed-req)
resp-map (build-success-resp-map resp-data)]
(log/info "东呈调用成功" resp-map)
(map->xml resp-map))
;; 处理失败的
(let [resp-data (prepare-failure-resp-data parsed-req)
resp-map (build-failure-resp-map resp-data)]
(log/info "东呈调用失败" resp-map)
(map->xml resp-map))))
)
))
next reply other threads:[~2024-09-17 1:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 1:27 vinurs [this message]
2024-09-17 12:29 ` bug#73310: tree-sitter makes cpu 100% Eli Zaretskii
2024-09-19 12:53 ` vinurs
2024-09-20 6:50 ` Yuan Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=etPan.66e8dafd.15470223.15a2e@vinurs.me \
--to=hi@vinurs.me \
--cc=73310@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.