Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
schedules
Commits
d0a3a0e2
Commit
d0a3a0e2
authored
Sep 11, 2018
by
Zac Wood
Browse files
Added back threading to make it SUPER FAST
parent
40540cf3
Pipeline
#2878
passed with stage
in 2 minutes and 24 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
schedules_api/db/seeds.rb
View file @
d0a3a0e2
...
@@ -7,7 +7,7 @@ require 'httparty'
...
@@ -7,7 +7,7 @@ require 'httparty'
require
'nokogiri'
require
'nokogiri'
require
'json'
require
'json'
#
threads = []
threads
=
[]
total
=
{}
total
=
{}
parser
=
PatriotWeb
::
Parser
.
new
parser
=
PatriotWeb
::
Parser
.
new
...
@@ -19,9 +19,9 @@ puts "DDOSing Patriot Web, buckle up kids"
...
@@ -19,9 +19,9 @@ puts "DDOSing Patriot Web, buckle up kids"
# parse all subjects and their courses in the semester
# parse all subjects and their courses in the semester
parser
.
parse_subjects
(
semester
).
each
do
|
subject
|
parser
.
parse_subjects
(
semester
).
each
do
|
subject
|
puts
"Getting courses for
#{
subject
}
"
puts
"Getting courses for
#{
subject
}
"
#
threads << Thread.new {
threads
<<
Thread
.
new
{
total
[
subject
]
=
parser
.
parse_courses_in_subject
(
subject
)
total
[
subject
]
=
parser
.
parse_courses_in_subject
(
subject
)
#
}
}
end
end
# For testing, only get first subject
# For testing, only get first subject
...
@@ -29,7 +29,7 @@ end
...
@@ -29,7 +29,7 @@ end
# total[subject] = parser.parse_courses_in_subject(subject)
# total[subject] = parser.parse_courses_in_subject(subject)
# wait for all the threads to finish
# wait for all the threads to finish
#
ThreadsWait.all_waits(*threads)
ThreadsWait
.
all_waits
(
*
threads
)
# delete everything in the current database
# delete everything in the current database
Closure
.
delete_all
Closure
.
delete_all
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment