Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing context init for multi threads #3

Open
wants to merge 1 commit into
base: 12-latest
Choose a base branch
from

Conversation

hcheng2002cn
Copy link

unit test with the script:

from pglast import parse_sql
import time
import threading

#cmd = 'SELECT * FROM (SELECT DISTINCT ON (Item) "Item", "Location" FROM "adam/UN"."t10" ORDER BY "Item", "Location" DESC) ORDER BY "Location" DESC;'
cmd = 'SELECT * FROM (SELECT DISTINCT ON (Item) "Item", "Location" FROM "adam/UN"."t10" ORDER BY "Item", "Location" DESC) a ORDER BY "Location" DESC;'

def parser():
	try:
		try:
			parse_sql(cmd)
            print("all good.")
		except Exception as e:
			print(e)
			raise
	except:
		time.sleep(1)
		pass

for i in range(100):
	x = threading.Thread(target=parser)
	time.sleep(1)
	x.start()

while 1:
	pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant