all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#73310: tree-sitter makes cpu 100%
@ 2024-09-17  1:27 vinurs
  2024-09-17 12:29 ` Eli Zaretskii
  0 siblings, 1 reply; 21+ messages in thread
From: vinurs @ 2024-09-17  1:27 UTC (permalink / raw)
  To: 73310


[-- 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))))
      )


    ))

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-12-20 12:15 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17  1:27 bug#73310: tree-sitter makes cpu 100% vinurs
2024-09-17 12:29 ` Eli Zaretskii
2024-09-19 12:53   ` vinurs
2024-09-20  6:50     ` Yuan Fu
2024-11-10 11:22       ` vinurs
2024-11-10 11:28         ` Eli Zaretskii
2024-11-10 11:35           ` vinurs
2024-11-25  1:48             ` Yuan Fu
2024-11-25 11:21               ` vinurs
2024-12-07 12:22                 ` Eli Zaretskii
2024-12-11  7:04                   ` Yuan Fu
2024-12-11  7:44                     ` vinurs
2024-12-11  8:10                       ` vinurs
2024-12-12  4:52                         ` Yuan Fu
2024-12-18 15:22                           ` vinurs
2024-12-19 18:33                             ` Yuan Fu
2024-12-19 21:34                               ` vinurs
2024-12-20  8:25                                 ` Yuan Fu
2024-12-20  8:37                                   ` Eli Zaretskii
2024-12-20  9:14                                     ` Yuan Fu
2024-12-20 12:15                                       ` Eli Zaretskii

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.