Subversion Repositories SmartDukaan

Rev

Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37685 21 d 7 h amit /trunk/profitmandi-fofo/ Remove selenium from the fofo portal entirely

No browser starts in this WAR any more, and the selenium-java and
webdrivermanager dependencies are gone with it. Verified: no source reference to
selenium/WebDriver/ChromeDriver anywhere in the module, and zero selenium
artifacts on the runtime classpath.

Three pieces:

1. The insights schedule and its pull move to profitmandi-cron (r37684) and dao
(r37683). This service keeps only the READ paths -- redis, then in-memory,
then cs.agent_daily_insight -- plus refreshInsights(), which now asks the dao
sync service to run once and re-reads what it wrote. The portal therefore
holds no credentials at all: KNOWLARITY_USERNAME/PASSWORD are deleted from
this source, along with INSIGHTS_PAGE_URL and the 200-character CSS selector
the scrape depended on.

2. KnowlarityScraperService deleted. It was dead, not merely idle: zero
references anywhere, both @Scheduled annotations commented out, and its
@PostConstruct selenium block commented out with the note 'DISABLED - Live
status now comes from WebSocket via profitmandi-cron'. SVN backs that up --
r36057/r36058 (25-Mar) moved agent status to the websocket and r36072/r36075
(26-Mar) created KnowlarityBreakLogService in dao, but nobody removed the
corpse. It kept selenium in this WAR for six months after nothing used it.
The data agrees: 'On Break - <reason>' rows in cs.rbm_break_log stop on
25-27 March and plain 'Break' takes over, which is exactly that handover.

⚠ Consequence worth knowing: break-REASON granularity (lunch/meeting/sick)
was lost at that migration and is not coming back from the websocket feed.

3. setTokens() and POST /indent/set_knowlarity_tokens removed -- the method had
already been reduced to a log line, and the pull now authenticates itself per
run. Also retired the orphan knowlarity.scraper.enabled property (nothing read
it; it was still 'true' in prod), and corrected a stale section header and a
doc comment that promised 'current tokens' which no longer exist.

Not touched, deliberately: POST update_agent_status / bulk_update_agent_status /
update_status_by_name still exist and still write cs.rbm_break_log through
AgentLiveStatusService. They are orphaned -- the deleted scraper was their only
feeder and no view or script in the deployed WAR calls them -- but they are
public HTTP surface, so proving there is no INTERNAL caller is not the same as
proving no external one. Left for a separate decision.
 
37678 21 d 9 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ Replace the knowlarity insights chrome scrape with SR's own JSON API

Drops the last unattended headless chrome out of the fofo tomcat. The scheduled
insights job ran 8 times a day and each run started an ~850MB chrome tree inside
the tomcat JVM's host -- a box holding -Xmx8g tomcat plus a -Xmx2g cron jar on
16GB that has been kernel-OOM-killed twice with tomcat the victim.

It was also losing data the whole time. Verified on prod across 7 consecutive
days: every row of cs.agent_daily_insight has logged_in_seconds, break_seconds,
available_seconds, talk_seconds, calls_answered, missed_calls and total_calls
set to 0. Two separate causes, both fixed here:

- parseTimeToSeconds split on ':' expecting 'HH:mm:ss', but the table renders
'2h 50m 39s'. A one-element split fell through to return 0, and because it
never reached the NumberFormatException branch it did not even warn. It now
parses the h/m/s shape and still accepts HH:mm:ss and HH:mm.
- the scrape never captured the call counts at all. The API carries them.

The auth chain is four calls and is not guessable, so it is documented in
KnowlarityApiClient: POST /vr/sr_login/ establishes the session and returns an
HS256 token that the API REJECTS; GET /newsr/user_details yields new_sr_ui_url
carrying a one-shot SSO blob (in a browser this hop is javascript, so it is
invisible to anything that merely follows redirects); POST /vr/sso_login/
exchanges that blob for the RS256 token the API accepts, whose claims embed the
srsessionid and so bind it to the session; GET /newsr/agents_insights/ with
header jwtAuthorization. Wrong token and wrong header name both answer
'Invalid token', so the error never tells you which mistake you made. The window
parameters are start_time/end_time -- start_date/end_date authenticates fine and
returns 'Error in API'.

Redirects are followed BY HAND. setInstanceFollowRedirects(true) exposes only
the final response's headers, so the Set-Cookie issued on the intermediate hops
is lost, the session never forms and user_details answers with an HTML error
page. This cost a debugging cycle; the reason is commented at the call site.

Verified against the live account before committing: 13 agents returned,
calls_offered == calls_answered + missed_calls holds for all 13, durations match
the previous scrape to within the elapsed window (~55s), and formatSeconds /
parseTimeToSeconds round-trip cleanly over the real values.

DTO fields stay the same display strings ('2h 50m 39s'), so every existing
reader is unaffected; only the previously-zero numeric columns change.

KnowlarityScraperService still uses ChromeDriver for operator-triggered break-log
scrapes, so the selenium dependency stays for now. Its @Scheduled annotations are
already commented out, so nothing unattended starts a browser any more.
 
37674 21 d 11 h amit /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ Hold the browser lane around the knowlarity scrapes

These run Chrome inside the tomcat JVM, on the same box as the cron jar's
oppo/realme imei lane, with nothing coordinating the two. isScraping only guards
this JVM and cannot see the cron's driver, so the interlock has to be the
OS-level one -- BrowserLane, common r37672.

Fifteen minutes rather than the cron side's five: the insights scrape runs only
8 times a day against a lane that is busy ~96% of the time, so a short timeout
here would mean the insights never refreshed. On contention it serves cache.

The break-log scraper takes the lane around its freshDriver, which has a clean
try/finally bracket. setupDriver()'s long-lived field driver is deliberately left
alone -- its lifetime spans init to @PreDestroy and holding an OS lock that long
would starve the imei lane.
 
37651 22 d 9 h vikas /trunk/ LMS click to call  
37540 31 d 7 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ loi process added, revival and code changes process  
37227 65 d 6 h ranu /trunk/ password update knowlarity  
37022 93 d 12 h ranu /trunk/ targeted calling count on today po rbm  
36469 157 d 9 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ without vendor catalog pricing po will not create  
36467 157 d 9 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ without vendor catalog pricing po will not create  
36466 157 d 10 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ without vendor catalog pricing po will not create  
36326 170 d 11 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ rbm rating dashboard view commited  
36315 171 d 10 h ranu /trunk/ rbm rating dashboard view commited  
36243 181 d 5 h aman /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ Fix:Correct monthly sale  
36235 181 d 10 h ranu /trunk/profitmandi-fofo/src/main/ back date data ..........dashboard display on calling  
36210 184 d 7 h ranu /trunk/ rbm l1,l2,l3 layer introduce  
36192 185 d 9 h ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ agent insights tracking  
36190 185 d 11 h ranu /trunk/ agent insights tracking  
36179 189 d 1 h ranu /trunk/ weekly rating system live on calling module  
36057 197 d 8 h ranu /trunk/ code commit via websocket instead of selenium for agent status  
36017 204 d 7 h ranu /trunk/ avaialble status multiple times coming it has been fix  

Show All